Add currency

This commit is contained in:
Sebastien Castiel
2023-12-06 15:23:18 -05:00
parent 570aa713b1
commit 72fe199879
7 changed files with 49 additions and 13 deletions

View File

@@ -9,6 +9,7 @@ export async function createGroup(groupFormValues: GroupFormValues) {
data: {
id: uuidv4(),
name: groupFormValues.name,
currency: groupFormValues.currency,
participants: {
createMany: {
data: groupFormValues.participants.map(({ name }) => ({
@@ -120,6 +121,7 @@ export async function updateGroup(
where: { id: groupId },
data: {
name: groupFormValues.name,
currency: groupFormValues.currency,
participants: {
deleteMany: existingGroup.participants.filter(
(p) => !groupFormValues.participants.some((p2) => p2.id === p.id),

View File

@@ -6,6 +6,10 @@ export const groupFormSchema = z
.string()
.min(2, 'Enter at least two characters.')
.max(50, 'Enter at most 50 characters.'),
currency: z
.string()
.min(1, 'Enter at least one character.')
.max(5, 'Enter at most five characters.'),
participants: z
.array(
z.object({