Added behavior journal, adjusted layout, and added some colors
This commit is contained in:
1 parent
b1b89ad334
commit
3237cd7601
31 files changed
+2135
-275
No files matched your search
@@ -0,0 +1,40 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
export const behaviorTypeSchema = z.object({
|
||||
name: z.string().trim().min(1).max(120),
|
||||
description: z.string().trim().max(2000).nullable().optional(),
|
||||
});
|
||||
export const behaviorOccurrenceSchema = z.object({
|
||||
behaviorTypeId: z.string().uuid(),
|
||||
occurredAt: z.string().datetime({ offset: true }),
|
||||
durationSeconds: z.number().finite().positive().max(31536000).nullable().optional(),
|
||||
severity: z.number().int().min(1).max(5).nullable().optional(),
|
||||
notes: z.string().trim().max(10000).nullable().optional(),
|
||||
});
|
||||
export const behaviorRangeSchema = z.object({
|
||||
from: z.string().datetime({ offset: true }),
|
||||
to: z.string().datetime({ offset: true }),
|
||||
behaviorTypeId: z.string().uuid().optional(),
|
||||
}).refine(({ from, to }) => Date.parse(to) > Date.parse(from) && Date.parse(to) - Date.parse(from) <= 32 * 86400000, {
|
||||
message: 'Choose a date range of up to 32 days, with to after from.',
|
||||
});
|
||||
export type BehaviorInput = z.infer<typeof behaviorOccurrenceSchema>;
|
||||
|
||||
export type BehaviorType = {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string | null;
|
||||
createdAt: Date;
|
||||
};
|
||||
export type BehaviorOccurrence = {
|
||||
id: string;
|
||||
birdId: string;
|
||||
behaviorTypeId: string;
|
||||
behaviorName: string;
|
||||
occurredAt: Date;
|
||||
durationSeconds: number | null;
|
||||
severity: number | null;
|
||||
notes: string | null;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
};
|
||||
Reference in new issue
Block a user