11import { z } from "zod" ;
22import { nicknameSchema } from "../../shared" ;
33
4+ const creatorSchema = z . object ( {
5+ id : z . number ( ) . int ( ) . positive ( ) ,
6+ } ) ;
7+
8+ const optionSchema = z . object ( {
9+ name : z . string ( ) ,
10+ } ) ;
11+
12+ const settingsSchema = z . object ( {
13+ defaultBetAmount : z . number ( ) . int ( ) . positive ( ) ,
14+ duration : z . number ( ) . int ( ) . positive ( ) ,
15+ } ) ;
16+
417const responseFetchBetRoomInfoSchema = z . object ( {
518 channel : z . object ( {
619 id : z . string ( ) ,
@@ -19,14 +32,6 @@ const responseFetchBetRoomInfoSchema = z.object({
1932 } ) ,
2033} ) ;
2134
22- const creatorSchema = z . object ( {
23- id : z . number ( ) . int ( ) . positive ( ) ,
24- } ) ;
25-
26- const optionSchema = z . object ( {
27- name : z . string ( ) ,
28- } ) ;
29-
3035const channelSchema = z . object ( {
3136 id : z . string ( ) ,
3237 title : z . string ( ) ,
@@ -36,10 +41,7 @@ const channelSchema = z.object({
3641 option2 : optionSchema ,
3742 } ) ,
3843 status : z . enum ( [ "waiting" , "active" , "timeover" , "finished" ] ) ,
39- settings : z . object ( {
40- defaultBetAmount : z . number ( ) . int ( ) . positive ( ) ,
41- duration : z . number ( ) . int ( ) . positive ( ) ,
42- } ) ,
44+ settings : settingsSchema ,
4345 metadata : z . object ( {
4446 createdAt : z . string ( ) . datetime ( ) ,
4547 startAt : z . string ( ) . datetime ( ) . nullable ( ) ,
@@ -51,6 +53,26 @@ const channelSchema = z.object({
5153 isAdmin : z . boolean ( ) ,
5254} ) ;
5355
56+ const summaryChannelSchema = z . object ( {
57+ title : z . string ( ) ,
58+ options : z . object ( {
59+ option1 : optionSchema ,
60+ option2 : optionSchema ,
61+ } ) ,
62+ status : z . enum ( [ "waiting" , "active" , "timeover" , "finished" ] , {
63+ message : "status는 waiting, active, timeover, finished 중 하나여야 합니다." ,
64+ } ) ,
65+ settings : settingsSchema ,
66+ } ) ;
67+
68+ const summaryResponseSchema = z . object ( {
69+ status : z . number ( ) . int ( ) . positive ( ) ,
70+ data : z . object ( {
71+ channel : channelSchema ,
72+ message : z . string ( ) ,
73+ } ) ,
74+ } ) ;
75+
5476const responseBetRoomInfo = z . object ( {
5577 channel : channelSchema ,
5678 message : z . string ( ) ,
@@ -60,9 +82,14 @@ type responseFetchBetRoomInfoType = z.infer<
6082 typeof responseFetchBetRoomInfoSchema
6183> ;
6284
85+ type summaryResponseType = z . infer < typeof summaryResponseSchema > ;
86+
6387export {
6488 channelSchema ,
6589 responseFetchBetRoomInfoSchema ,
6690 responseBetRoomInfo ,
91+ summaryChannelSchema ,
92+ summaryResponseSchema ,
6793 type responseFetchBetRoomInfoType ,
94+ type summaryResponseType ,
6895} ;
0 commit comments