diff --git a/src/routes/api/user/+server.ts b/src/routes/api/user/+server.ts index 9d994f5..7e30cf8 100644 --- a/src/routes/api/user/+server.ts +++ b/src/routes/api/user/+server.ts @@ -20,18 +20,18 @@ export const GET = (async ({ url }) => { [sequelize.fn('MAX', sequelize.col('striked_at')), 'striked_at'] ], include: { model: StrikeReason, as: 'strike_reason' } - })) as { weight: number | null; striked_at: Date | null } | null; + })) as { dataValues: { weight: number | null; striked_at: Date | null } } | null; const ban_time = ( await StrikePunishment.findOne({ attributes: ['punishment_in_seconds'], - where: { type: ['ban'], weight: { [Op.lte]: query?.weight } }, + where: { type: ['ban'], weight: { [Op.lte]: query?.dataValues.weight } }, order: [['weight', 'DESC']] }) )?.punishment_in_seconds; const outlawed_time = ( await StrikePunishment.findOne({ attributes: ['punishment_in_seconds'], - where: { type: ['outlawed'], weight: { [Op.lte]: query?.weight } }, + where: { type: ['outlawed'], weight: { [Op.lte]: query?.dataValues.weight } }, order: [['weight', 'DESC']] }) )?.punishment_in_seconds; @@ -43,12 +43,12 @@ export const GET = (async ({ url }) => { firstname: user.firstname, lastname: user.lastname, banned_until: - query && query.striked_at && ban_time - ? Math.round(query.striked_at.getTime() / 1000 + ban_time!) + query && query.dataValues.striked_at && ban_time + ? Math.round(query.dataValues.striked_at.getTime() / 1000 + ban_time) : null, outlawed_until: - query && query.striked_at && outlawed_time - ? Math.round(query.striked_at.getTime() / 1000 + outlawed_time!) + query && query.dataValues.striked_at && outlawed_time + ? Math.round(query.dataValues.striked_at.getTime() / 1000 + outlawed_time) : null }), { status: 200 }