This is actually fantastic, I'm really happy with how this has worked so far. My only concern for the future is how posting reviews from the `/ratings` path might work, since it's currently designed around posting reviews from the song page itself, but I think some HTMX and/or JS wil alleviate any problems I run into
12 lines
407 B
Zig
12 lines
407 B
Zig
const std = @import("std");
|
|
const jetzig = @import("jetzig");
|
|
pub fn post(request: *jetzig.Request) !jetzig.View {
|
|
var root = try request.data(.object);
|
|
const params = try request.params();
|
|
const id = params.getT(.integer, "song_id");
|
|
const review = params.getT(.string, "review");
|
|
try root.put("song_id", id);
|
|
try root.put("review", review);
|
|
|
|
return request.render(.created);
|
|
}
|