From 397c30212f84a686221bb1d05d7029bc0fd0bdf4 Mon Sep 17 00:00:00 2001 From: Dev-CasperTheGhost <53900565+Dev-CasperTheGhost@users.noreply.github.com> Date: Tue, 2 Nov 2021 07:48:41 +0100 Subject: [PATCH] :hammer: fix minor bugs closes #101 closes #102 --- packages/api/src/controllers/admin/Values.ts | 8 +++++++- .../src/components/admin/values/ManageValueModal.tsx | 2 +- packages/schemas/src/admin/values.ts | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/api/src/controllers/admin/Values.ts b/packages/api/src/controllers/admin/Values.ts index 0ab3300bd..4793c3b25 100644 --- a/packages/api/src/controllers/admin/Values.ts +++ b/packages/api/src/controllers/admin/Values.ts @@ -250,12 +250,18 @@ export class ValuesController { if (data) { // @ts-expect-error ignore - await prisma[data.name].delete({ + const deleted = await prisma[data.name].delete({ where: { id, }, }); + await prisma.value.delete({ + where: { + id: deleted.valueId, + }, + }); + return true; } diff --git a/packages/client/src/components/admin/values/ManageValueModal.tsx b/packages/client/src/components/admin/values/ManageValueModal.tsx index c52bdc14d..3e744ba5e 100644 --- a/packages/client/src/components/admin/values/ManageValueModal.tsx +++ b/packages/client/src/components/admin/values/ManageValueModal.tsx @@ -232,7 +232,7 @@ export const ManageValueModal = ({ onCreate, onUpdate, clType: dlType, type, val /> - + {errors.color} diff --git a/packages/schemas/src/admin/values.ts b/packages/schemas/src/admin/values.ts index 8a831a280..cf5682f68 100644 --- a/packages/schemas/src/admin/values.ts +++ b/packages/schemas/src/admin/values.ts @@ -1,7 +1,7 @@ import { z } from "zod"; export const VALUE_SCHEMA = z.object({ - value: z.string().min(2).max(255), + value: z.string().min(1).max(255), }); export const CREATE_PENAL_CODE_SCHEMA = z.object({