fix strike date not set if status changed but strike reason not
All checks were successful
delpoy / build-and-deploy (push) Successful in 40s
All checks were successful
delpoy / build-and-deploy (push) Successful in 40s
This commit is contained in:
parent
8e60f83b6f
commit
3dd56bc471
@ -134,7 +134,10 @@ export const PATCH = (async ({ request, cookies }) => {
|
|||||||
} else if (data.strike_reason == -1 && report.strike_reason_id != null) {
|
} else if (data.strike_reason == -1 && report.strike_reason_id != null) {
|
||||||
report.strike_reason_id = null;
|
report.strike_reason_id = null;
|
||||||
report.striked_at = null;
|
report.striked_at = null;
|
||||||
} else if (data.strike_reason != -1 && data.strike_reason != report.strike_reason_id) {
|
} else if (
|
||||||
|
data.strike_reason != -1 &&
|
||||||
|
(data.strike_reason != report.strike_reason_id || data.status != report.status)
|
||||||
|
) {
|
||||||
if (!report.reported_id) return new Response(null, { status: 400 });
|
if (!report.reported_id) return new Response(null, { status: 400 });
|
||||||
const strike_reason = await StrikeReason.findByPk(data.strike_reason);
|
const strike_reason = await StrikeReason.findByPk(data.strike_reason);
|
||||||
if (strike_reason == null) return new Response(null, { status: 400 });
|
if (strike_reason == null) return new Response(null, { status: 400 });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user