@@ -19,7 +19,7 @@ type EventRepository interface {
1919 GetEvents (ctx context.Context , filter EventFilter ) (tData int , data []Event , err error )
2020 CreateEventPay (ctx context.Context , event EventPay ) (uint , error )
2121 CreateRegistrationEvent (ctx context.Context , event RegistrationEvent ) (uint , error )
22- GetEvent (ctx context.Context , eventID uint ) (data Event , err error )
22+ GetEvent (ctx context.Context , eventID uint ) (data EventDTO , err error )
2323 DeleteEvent (ctx context.Context , eventID uint ) (err error )
2424 GetRegistrationEvent (ctx context.Context , orderNo string ) (data RegistrationEvent , err error )
2525 ListRegistration (ctx context.Context , filter EventFilter , email string ) (tData int , data []RegistrationEvent , err error )
@@ -36,7 +36,7 @@ type EventUsecase interface {
3636 GetEvents (ctx context.Context , filter EventFilter ) (data []Event , pagination Pagination , err error )
3737 CreateRegistrationEvent (ctx context.Context , payload RegisterEventPayload ) (RegisterEventResponse , error )
3838 CreateEventPay (ctx context.Context , payload EventPayPayload ) error
39- GetEventByID (ctx context.Context , id uint ) (resp Event , err error )
39+ GetEventByID (ctx context.Context , id uint ) (resp EventDTO , err error )
4040 DeleteEvent (ctx context.Context , id uint ) (err error )
4141 RegistrationStatus (ctx context.Context , orderNo string ) (resp RegisterStatusResponse , err error )
4242 ListRegistration (ctx context.Context , filter EventFilter ) (resp []RegistrationEvent , pagination Pagination , err error )
@@ -64,21 +64,20 @@ type Event struct {
6464 Title string `json:"title" `
6565 Description string `json:"description"`
6666 Slug string `json:"slug"`
67- Author string `json:"author"`
67+ AuthorID int `json:"author_id"`
68+ Author User `gorm:"foreignKey:AuthorID;references:ID"` // Ensure foreign key is correctly referenced
6869 Image string `json:"image"`
6970 Date null.Time `json:"date"`
7071 Type string `json:"type"`
7172 Location string `json:"location"`
7273 Duration string `json:"duration"`
7374 Capacity int `json:"capacity"`
74- Status string `json:"status"` // comming soon
75+ Status string `json:"status"` // Conference, Tech Talk, Workshop, Webinar, etc.
7576 Tags []EventTag `gorm:"foreignKey:EventID;constraint:OnDelete:CASCADE;"` // Ensure foreign key is correctly referenced
7677 Speakers []EventSpeaker `gorm:"foreignKey:EventID;constraint:OnDelete:CASCADE;"` // Ensure foreign key is correctly referenced
78+ SessionType string `json:"session_type"` // online, offline, hybrid
7779 RegistrationLink string `json:"registration_link"`
7880 Price float64 `json:"price"` // 0 == free
79- CreatedBy int `json:"created_by"`
80- UpdatedBy int `json:"updated_by"`
81- DeletedBy int `json:"deleted_by"`
8281 ReservationStartDate null.Time `json:"reservation_start_date"`
8382 ReservationEndDate null.Time `json:"reservation_end_date"`
8483 CreatedAt time.Time `json:"created_at"`
@@ -156,17 +155,29 @@ type UpdateEventPayload struct {
156155}
157156
158157type EventDTO struct {
159- ID int `json:"id"`
160- Title string `json:"title"`
161- Description string `json:"description"`
162- Author string `json:"author"`
163- ImageEvent string `json:"image_event"`
164- DateEvent null.Time `json:"date_event"`
165- Type string `json:"type"`
166- Location string `json:"location"`
167- Duration string `json:"duration"`
168- Capacity int `json:"capacity"`
169- RegistrationLink string `json:"registration_link"`
158+ ID uint `json:"id" gorm:"primarykey"`
159+ Title string `json:"title" `
160+ Description string `json:"description"`
161+ Slug string `json:"slug"`
162+ Author string `json:"author"`
163+ Image string `json:"image"`
164+ Date null.Time `json:"date"`
165+ Type string `json:"type"`
166+ Location string `json:"location"`
167+ Duration string `json:"duration"`
168+ Capacity int `json:"capacity"`
169+ Status string `json:"status"` // Conference, Tech Talk, Workshop, Webinar, etc.
170+ Tags []EventTag `gorm:"foreignKey:EventID;constraint:OnDelete:CASCADE;"` // Ensure foreign key is correctly referenced
171+ Speakers []EventSpeaker `gorm:"foreignKey:EventID;constraint:OnDelete:CASCADE;"` // Ensure foreign key is correctly referenced
172+ SessionType string `json:"session_type"` // online, offline, hybrid
173+ RegistrationLink string `json:"registration_link"`
174+ Price float64 `json:"price"` // 0 == free
175+ ReservationStartDate null.Time `json:"reservation_start_date"`
176+ ReservationEndDate null.Time `json:"reservation_end_date"`
177+ CreatedAt time.Time `json:"created_at"`
178+ UpdatedAt null.Time `json:"updated_at"`
179+ DeletedAt null.Time `json:"deleted_at"`
180+ AdditionalLink string `json:"additional_link"`
170181}
171182
172183type UpdateEvenPayload struct {
0 commit comments