feat: initialize monorepo structure with Bun and Turborepo
- Add package.json for the root with workspace configuration and scripts - Create @gruperly/config package with TypeScript configuration - Establish shared package @gruperly/shared with Zod schemas for validation - Implement group, student, and payment schemas using Zod - Set up TypeScript configuration for shared package - Document stack architecture and technical specifications in stack.md - Configure Turborepo with build, dev, lint, and typecheck tasks
This commit is contained in:
3
packages/shared/src/index.ts
Normal file
3
packages/shared/src/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './schemas/group.schema'
|
||||
export * from './schemas/student.schema'
|
||||
export * from './schemas/payment.schema'
|
||||
15
packages/shared/src/schemas/group.schema.ts
Normal file
15
packages/shared/src/schemas/group.schema.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
export const createGroupSchema = z.object({
|
||||
name: z.string().min(1, 'El nombre es obligatorio'),
|
||||
description: z.string().optional(),
|
||||
})
|
||||
|
||||
export const updateGroupSchema = createGroupSchema.partial()
|
||||
|
||||
export const groupIdParamsSchema = z.object({
|
||||
id: z.string().min(1),
|
||||
})
|
||||
|
||||
export type CreateGroupInput = z.infer<typeof createGroupSchema>
|
||||
export type UpdateGroupInput = z.infer<typeof updateGroupSchema>
|
||||
17
packages/shared/src/schemas/payment.schema.ts
Normal file
17
packages/shared/src/schemas/payment.schema.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
export const paymentStatusSchema = z.enum(['PENDING', 'PAID', 'OVERDUE', 'CANCELLED'])
|
||||
|
||||
export const createPaymentSchema = z.object({
|
||||
groupId: z.string().min(1),
|
||||
studentId: z.string().min(1),
|
||||
amount: z.coerce.number().positive(),
|
||||
currency: z.string().default('MXN'),
|
||||
dueDate: z.coerce.date(),
|
||||
status: paymentStatusSchema.optional(),
|
||||
})
|
||||
|
||||
export const updatePaymentSchema = createPaymentSchema.partial()
|
||||
|
||||
export type CreatePaymentInput = z.infer<typeof createPaymentSchema>
|
||||
export type UpdatePaymentInput = z.infer<typeof updatePaymentSchema>
|
||||
16
packages/shared/src/schemas/student.schema.ts
Normal file
16
packages/shared/src/schemas/student.schema.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
export const createStudentSchema = z.object({
|
||||
groupId: z.string().min(1),
|
||||
fullName: z.string().min(1, 'El nombre completo es obligatorio'),
|
||||
email: z.string().email().optional().or(z.literal('')),
|
||||
phone: z.string().optional().or(z.literal('')),
|
||||
guardianName: z.string().optional().or(z.literal('')),
|
||||
guardianPhone: z.string().optional().or(z.literal('')),
|
||||
notes: z.string().optional().or(z.literal('')),
|
||||
})
|
||||
|
||||
export const updateStudentSchema = createStudentSchema.omit({ groupId: true }).partial()
|
||||
|
||||
export type CreateStudentInput = z.infer<typeof createStudentSchema>
|
||||
export type UpdateStudentInput = z.infer<typeof updateStudentSchema>
|
||||
Reference in New Issue
Block a user