mirror of
https://github.com/formbricks/formbricks.git
synced 2025-12-30 18:30:32 -06:00
Add Timestamps to person model (#490)
This commit is contained in:
committed by
GitHub
parent
33811f9349
commit
8585cb8c7c
@@ -12,11 +12,15 @@ type TransformPersonInput = {
|
||||
name: string;
|
||||
};
|
||||
}[];
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
};
|
||||
|
||||
export type TransformPersonOutput = {
|
||||
id: string;
|
||||
attributes: Record<string, string | number>;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
};
|
||||
|
||||
export const transformPrismaPerson = (person: TransformPersonInput | null): TransformPersonOutput | null => {
|
||||
@@ -32,6 +36,8 @@ export const transformPrismaPerson = (person: TransformPersonInput | null): Tran
|
||||
return {
|
||||
id: person.id,
|
||||
attributes: attributes,
|
||||
createdAt: person.createdAt,
|
||||
updatedAt: person.updatedAt
|
||||
};
|
||||
};
|
||||
|
||||
@@ -78,6 +84,8 @@ export const getPeople = cache(async (environmentId: string): Promise<TPerson[]>
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
createdAt: true,
|
||||
updatedAt: true,
|
||||
attributes: {
|
||||
select: {
|
||||
value: true,
|
||||
|
||||
@@ -19,6 +19,8 @@ const responseSelection = {
|
||||
person: {
|
||||
select: {
|
||||
id: true,
|
||||
createdAt: true,
|
||||
updatedAt: true,
|
||||
attributes: {
|
||||
select: {
|
||||
value: true,
|
||||
|
||||
@@ -6,6 +6,8 @@ export type TPersonAttributes = z.infer<typeof ZPersonAttributes>;
|
||||
export const ZPerson = z.object({
|
||||
id: z.string().cuid2(),
|
||||
attributes: ZPersonAttributes,
|
||||
createdAt: z.date(),
|
||||
updatedAt: z.date()
|
||||
});
|
||||
|
||||
export type TPerson = z.infer<typeof ZPerson>;
|
||||
|
||||
@@ -36,6 +36,8 @@ const ZResponse = z.object({
|
||||
.object({
|
||||
id: z.string().cuid2(),
|
||||
attributes: z.record(z.union([z.string(), z.number()])),
|
||||
createdAt: z.date(),
|
||||
updatedAt: z.date(),
|
||||
})
|
||||
.nullable(),
|
||||
personAttributes: ZResponsePersonAttributes,
|
||||
|
||||
Reference in New Issue
Block a user