@@ -8,12 +8,12 @@ type Event struct {
88 Description string `json:"description"`
99 ClubID uint `json:"club_id" gorm:"not null"`
1010 EventType EventType `json:"event_type" gorm:"type:varchar(20)"`
11- EventDate time.Time `json:"event_date" gorm:"not null"`
12- EventTime time.Time `json:"event_time" gorm:"not null"`
11+ EventDate time.Time `json:"event_date" gorm:"type:date; not null"`
12+ EventTime time.Time `json:"event_time" gorm:"type:time; not null"`
1313 Location string `json:"location,omitempty"`
1414 OnlineLink string `json:"online_link,omitempty"`
1515 MaxAttendees * int `json:"max_attendees,omitempty"`
16- IsPublic bool `json:"is_public" gorm:"default:false"`
16+ IsPublic bool `json:"is_public" gorm:"default:false"`
1717 CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`
1818 Club Club `json:"club" gorm:"foreignKey:ClubID"`
1919 RSVPs []EventRSVP `json:"rsvps,omitempty"`
@@ -48,24 +48,24 @@ type CreateEventRequest struct {
4848 Title string `json:"title" binding:"required"`
4949 Description string `json:"description"`
5050 EventType EventType `json:"event_type" binding:"required,oneof=in_person online"`
51- EventDate time.Time `json:"event_date" binding:"required"`
52- EventTime time.Time `json:"event_time" binding:"required"`
51+ EventDate time.Time `json:"event_date" binding:"required" time_format:"2006-01-02" `
52+ EventTime time.Time `json:"event_time" binding:"required" time_format:"15:04" `
5353 Location string `json:"location,omitempty"`
5454 OnlineLink string `json:"online_link,omitempty"`
5555 MaxAttendees * int `json:"max_attendees,omitempty"`
56- IsPublic bool `json:"is_public" gorm:"default:false"`
56+ IsPublic bool `json:"is_public" gorm:"default:false"`
5757}
5858
5959type UpdateEventRequest struct {
6060 Title * string `json:"title,omitempty"`
6161 Description * string `json:"description,omitempty"`
6262 EventType * EventType `json:"event_type,omitempty" binding:"omitempty,oneof=in_person online"`
63- EventDate * time.Time `json:"event_date,omitempty" binding:"omitempty"`
64- EventTime * time.Time `json:"event_time,omitempty" binding:"omitempty"`
63+ EventDate * time.Time `json:"event_date,omitempty" binding:"omitempty" time_format:"2006-01-02" `
64+ EventTime * time.Time `json:"event_time,omitempty" binding:"omitempty" time_format:"15:04" `
6565 Location * string `json:"location,omitempty"`
6666 OnlineLink * string `json:"online_link,omitempty"`
6767 MaxAttendees * int `json:"max_attendees,omitempty"`
68- IsPublic * bool `json:"is_public,omitempty"`
68+ IsPublic * bool `json:"is_public,omitempty"`
6969}
7070
7171type RSVPRequest struct {
@@ -95,8 +95,8 @@ func (e *Event) ToResponse() EventResponse {
9595 Description : e .Description ,
9696 ClubID : e .ClubID ,
9797 EventType : e .EventType ,
98- EventDate : e .EventDate .Format (time . RFC3339 ),
99- EventTime : e .EventTime .Format (time . RFC3339 ),
98+ EventDate : e .EventDate .Format ("2006-01-02" ),
99+ EventTime : e .EventTime .Format ("15:04" ),
100100 Location : e .Location ,
101101 OnlineLink : e .OnlineLink ,
102102 MaxAttendees : e .MaxAttendees ,
0 commit comments