All files / src/response group.ts

0% Statements 0/6
100% Branches 0/0
100% Functions 0/0
0% Lines 0/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55                                                                                                             
import { z } from '@hono/zod-openapi';
 
export const createGroupResponseSchema = z.object({
  group_id: z.uuid(),
  invite_id: z.string().min(1),
});
 
export type CreateGroupResponseSchemaType = z.infer<typeof createGroupResponseSchema>;
 
export const joinGroupResponseSchema = z.object({
  group_id: z.uuid(),
});
 
export type JoinGroupResponseSchemaType = z.infer<typeof joinGroupResponseSchema>;
 
export const getGroupInfoResponseMemberElementSchema = z.object({
  user_id: z.string().min(1),
  user_name: z.string().min(1),
});
 
export const getGroupInfoResponseSchema = z.object({
  group_name: z.uuid(),
  invite_id: z.string().min(1),
  created_by_id: z.string().min(1),
  created_by_name: z.string().min(1),
  members: z.array(getGroupInfoResponseMemberElementSchema),
});
 
export type GetGroupInfoResponseMemberElementSchemaType = z.infer<typeof getGroupInfoResponseMemberElementSchema>;
export type GetGroupInfoResponseSchemaType = z.infer<typeof getGroupInfoResponseSchema>;
 
export const getGroupDebtHistoryResponseElementSchema = z.object({
  debt_id: z.string().min(1),
  debtor_id: z.string().min(1),
  debtor_name: z.string().min(1),
  creditor_id: z.string().min(1),
  creditor_name: z.string().min(1),
  amount: z.number().min(0),
  description: z.string().min(0),
  occurred_at: z.string().regex(/^\d{4}-\d{2}-\d{2}$/),
  deleted_at: z
    .string()
    .regex(/^\d{4}-\d{2}-\d{2}$/)
    .nullable(),
  deleted_by_id: z.string().min(1).nullable(),
  deleted_by_name: z.string().min(1).nullable(),
});
 
export const getGroupDebtHistoryResponseSchema = z.object({
  debts: z.array(getGroupDebtHistoryResponseElementSchema),
});
 
export type GetGroupDebtHistoryResponseElementSchemaType = z.infer<typeof getGroupDebtHistoryResponseElementSchema>;
export type GetGroupDebtHistoryResponseSchemaType = z.infer<typeof getGroupDebtHistoryResponseSchema>;