diff --git a/src/api/services/files.zig b/src/api/services/files.zig index 6f9c08c..21ac8e8 100644 --- a/src/api/services/files.zig +++ b/src/api/services/files.zig @@ -92,9 +92,9 @@ pub fn update(db: anytype, id: Uuid, meta: PartialMeta, alloc: std.mem.Allocator if (builder.set_statements_appended == 0) return error.NoChange; - try builder.andWhere("id = $1"); + try builder.set("updated_at", "$6"); - std.log.debug("{any}", .{meta}); + try builder.andWhere("id = $1"); try db.exec(try builder.terminate(), .{ id, @@ -102,6 +102,7 @@ pub fn update(db: anytype, id: Uuid, meta: PartialMeta, alloc: std.mem.Allocator meta.description orelse null, meta.content_type orelse null, meta.sensitive orelse null, + DateTime.now(), }, alloc); } @@ -134,9 +135,9 @@ pub fn create(db: anytype, owner_id: Uuid, meta: FileMeta, data: []const u8, all try db.exec( \\UPDATE file_upload - \\SET status = 'uploaded' + \\SET status = 'uploaded', updated_at = $2 \\WHERE id = $1 - , .{id}, alloc); + , .{ id, DateTime.now() }, alloc); return id; }