mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-17 19:20:39 +09:00
20 lines
614 B
TypeScript
20 lines
614 B
TypeScript
|
|
import { z } from "zod";
|
||
|
|
import { COMPANY_STATUSES } from "../constants.js";
|
||
|
|
|
||
|
|
export const createCompanySchema = z.object({
|
||
|
|
name: z.string().min(1),
|
||
|
|
description: z.string().optional().nullable(),
|
||
|
|
budgetMonthlyCents: z.number().int().nonnegative().optional().default(0),
|
||
|
|
});
|
||
|
|
|
||
|
|
export type CreateCompany = z.infer<typeof createCompanySchema>;
|
||
|
|
|
||
|
|
export const updateCompanySchema = createCompanySchema
|
||
|
|
.partial()
|
||
|
|
.extend({
|
||
|
|
status: z.enum(COMPANY_STATUSES).optional(),
|
||
|
|
spentMonthlyCents: z.number().int().nonnegative().optional(),
|
||
|
|
});
|
||
|
|
|
||
|
|
export type UpdateCompany = z.infer<typeof updateCompanySchema>;
|