mirror of
https://github.com/FranP-code/spend-ia.git
synced 2025-10-13 00:14:09 +00:00
feat: added models
This commit is contained in:
17
packages/server/schemas/spendingCategory.ts
Normal file
17
packages/server/schemas/spendingCategory.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { z } from 'zod';
|
||||
import { Schema, model } from 'mongoose';
|
||||
import { type SpendingCategoryType } from '../types';
|
||||
|
||||
export const SpendingCategorySchema = z.object({
|
||||
backgroundColor: z.string(),
|
||||
label: z.string(),
|
||||
userId: z.string(),
|
||||
} satisfies SpendingCategoryType);
|
||||
|
||||
const schema = new Schema({
|
||||
backgroundColor: { required: true, type: String },
|
||||
label: { required: true, type: String },
|
||||
userId: { required: true, type: String },
|
||||
} satisfies SpendingCategoryType);
|
||||
|
||||
export const SpendingCategory = model('SpendingCategory', schema);
|
||||
Reference in New Issue
Block a user