fix badge creation

This commit is contained in:
Holly Stubbs 2024-10-13 16:55:23 +01:00
parent 494ce3fbce
commit f04444bb1b
Signed by: tgpholly
GPG key ID: B8583C4B7D18119E

View file

@ -48,7 +48,7 @@ export default abstract class BadgeRepo {
public static async insertUpdate(badge:Badge) {
if (badge.Id === Number.MIN_VALUE) {
badge.Id = (await Database.Instance.query("INSERT Badge (Name, Description, Hint, ImageUrl, ForUrl, IsSecret, CreatedByUserId, CreatedDatetime, LastModifiedByUserId, LastModifiedDatetime, DeletedByUserId, DeletedDatetime, IsDeleted) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING Id;", [
badge.Id = (await Database.Instance.query("INSERT Badge (Name, Description, Hint, ImageUrl, ForUrl, IsSecret, CreatedByUserId, CreatedDatetime, LastModifiedByUserId, LastModifiedDatetime, DeletedByUserId, DeletedDatetime, IsDeleted) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING Id;", [
badge.Name, badge.Description, badge.Hint, badge.ImageUrl, badge.ForUrl, Number(badge.IsSecret), badge.CreatedByUserId, badge.CreatedDatetime.getTime(), badge.LastModifiedByUserId ?? null, badge.LastModifiedDatetime?.getTime() ?? null, badge.DeletedByUserId ?? null, badge.DeletedDatetime?.getTime() ?? null, Number(badge.IsDeleted)
]))[0]["Id"];
} else {