stashing code
This commit is contained in:
52
packages/logic/domains/account/data/entities.ts
Normal file
52
packages/logic/domains/account/data/entities.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export const emailAccountPayloadModel = z.object({
|
||||
email: z.string().email().min(6).max(128),
|
||||
password: z.string().max(128),
|
||||
agentId: z.string().optional(),
|
||||
orderId: z.number().int().nullish().optional(),
|
||||
});
|
||||
export type EmailAccountPayload = z.infer<typeof emailAccountPayloadModel>;
|
||||
|
||||
export const emailAccountModel = emailAccountPayloadModel
|
||||
.pick({ email: true, agentId: true, orderId: true })
|
||||
.merge(
|
||||
z.object({
|
||||
id: z.number().int(),
|
||||
used: z.boolean().default(false),
|
||||
lastActiveCheckAt: z.coerce.string().optional(),
|
||||
createdAt: z.coerce.string(),
|
||||
updatedAt: z.coerce.string(),
|
||||
}),
|
||||
);
|
||||
export type EmailAccount = z.infer<typeof emailAccountModel>;
|
||||
|
||||
export const emailAccountFullModel = emailAccountPayloadModel.merge(
|
||||
z.object({
|
||||
id: z.number().int(),
|
||||
used: z.boolean().default(false),
|
||||
createdAt: z.coerce.string(),
|
||||
updatedAt: z.coerce.string(),
|
||||
}),
|
||||
);
|
||||
export type EmailAccountFull = z.infer<typeof emailAccountFullModel>;
|
||||
|
||||
export const inboxModel = z.object({
|
||||
id: z.number(),
|
||||
emailId: z.string().default(""),
|
||||
|
||||
from: z.string(),
|
||||
to: z.string().optional(),
|
||||
cc: z.string().optional(),
|
||||
subject: z.string(),
|
||||
body: z.string(),
|
||||
|
||||
attachments: z.any().optional(),
|
||||
emailAccountId: z.number(),
|
||||
|
||||
dated: z.coerce.string(),
|
||||
|
||||
createdAt: z.coerce.string(),
|
||||
updatedAt: z.coerce.string(),
|
||||
});
|
||||
export type InboxModel = z.infer<typeof inboxModel>;
|
||||
Reference in New Issue
Block a user