Fix updated_at field in api
This commit is contained in:
parent
22f2a03308
commit
03a5112036
1 changed files with 5 additions and 4 deletions
|
@ -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;
|
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(), .{
|
try db.exec(try builder.terminate(), .{
|
||||||
id,
|
id,
|
||||||
|
@ -102,6 +102,7 @@ pub fn update(db: anytype, id: Uuid, meta: PartialMeta, alloc: std.mem.Allocator
|
||||||
meta.description orelse null,
|
meta.description orelse null,
|
||||||
meta.content_type orelse null,
|
meta.content_type orelse null,
|
||||||
meta.sensitive orelse null,
|
meta.sensitive orelse null,
|
||||||
|
DateTime.now(),
|
||||||
}, alloc);
|
}, alloc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,9 +135,9 @@ pub fn create(db: anytype, owner_id: Uuid, meta: FileMeta, data: []const u8, all
|
||||||
|
|
||||||
try db.exec(
|
try db.exec(
|
||||||
\\UPDATE file_upload
|
\\UPDATE file_upload
|
||||||
\\SET status = 'uploaded'
|
\\SET status = 'uploaded', updated_at = $2
|
||||||
\\WHERE id = $1
|
\\WHERE id = $1
|
||||||
, .{id}, alloc);
|
, .{ id, DateTime.now() }, alloc);
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue