55 "net/http"
66 "time"
77
8+ "github.com/hammer-code/lms-be/constants"
89 "gopkg.in/guregu/null.v4"
910)
1011
@@ -67,23 +68,23 @@ type Event struct {
6768 Author string `json:"author"`
6869 Image string `json:"image"`
6970 Date null.Time `json:"date"`
70- Type string `json:"type"`
71+ Type constants. EventType `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- Tags []EventTag `gorm:"foreignKey:EventID;constraint:OnDelete:CASCADE;"` // Ensure foreign key is correctly referenced
76- Speakers []EventSpeaker `gorm:"foreignKey:EventID;constraint:OnDelete:CASCADE;"` // Ensure foreign key is correctly referenced
75+ Status string `json:"status"`
76+ Tags []EventTag `json:"tags" gorm:"foreignKey:EventID;constraint:OnDelete:CASCADE;"`
77+ Speakers []EventSpeaker `json:"speakers" gorm:"foreignKey:EventID;constraint:OnDelete:CASCADE;"`
7778 RegistrationLink string `json:"registration_link"`
7879 Price float64 `json:"price"` // 0 == free
79- CreatedBy int `json:"created_by "`
80- UpdatedBy int `json:"updated_by "`
81- DeletedBy int `json:"deleted_by "`
80+ CreatedBy int `json:"- "`
81+ UpdatedBy int `json:"- "`
82+ DeletedBy int `json:"- "`
8283 ReservationStartDate null.Time `json:"reservation_start_date"`
8384 ReservationEndDate null.Time `json:"reservation_end_date"`
8485 CreatedAt time.Time `json:"created_at"`
85- UpdatedAt null.Time `json:"updated_at "`
86- DeletedAt null.Time `json:"deleted_at "`
86+ UpdatedAt null.Time `json:"- "`
87+ DeletedAt null.Time `json:"- "`
8788 AdditionalLink string `json:"additional_link"`
8889}
8990
@@ -119,7 +120,7 @@ type CreateEventPayload struct {
119120 Slug string `json:"slug" validate:"required"`
120121 IsOnline string `json:"is_online" validate:"required"`
121122 Date null.Time `json:"date" validate:"required"`
122- Type string `json:"type" validate:"required"`
123+ Type constants. EventType `json:"type" validate:"required"`
123124 Location string `json:"location" validate:"required"`
124125 Duration string `json:"duration" validate:"required"`
125126 Status string `json:"status" validate:"required"`
@@ -141,7 +142,7 @@ type UpdateEventPayload struct {
141142 Slug string `json:"slug" validate:"required"`
142143 IsOnline string `json:"is_online" validate:"required"`
143144 Date null.Time `json:"date" validate:"required"`
144- Type string `json:"type" validate:"required"`
145+ Type constants. EventType `json:"type" validate:"required"`
145146 Location string `json:"location" validate:"required"`
146147 Duration string `json:"duration" validate:"required"`
147148 Status string `json:"status" validate:"required"`
@@ -162,7 +163,7 @@ type EventDTO struct {
162163 Author string `json:"author"`
163164 ImageEvent string `json:"image_event"`
164165 DateEvent null.Time `json:"date_event"`
165- Type string `json:"type"`
166+ Type constants. EventType `json:"type"`
166167 Location string `json:"location"`
167168 Duration string `json:"duration"`
168169 Capacity int `json:"capacity"`
@@ -175,7 +176,7 @@ type UpdateEvenPayload struct {
175176 Author string `json:"author"`
176177 ImageEvent string `json:"image_event"`
177178 DateEvent null.Time `json:"date_event"`
178- Type string `json:"type"`
179+ Type constants. EventType `json:"type"`
179180 Location string `json:"location"`
180181 Duration string `json:"duration"`
181182 Capacity int `json:"capacity"`
@@ -185,7 +186,7 @@ type UpdateEvenPayload struct {
185186type EventFilter struct {
186187 ID uint
187188 Title string
188- Type string
189+ Type constants. EventType
189190 Status string
190191 StartDate null.Time
191192 EndDate null.Time
@@ -228,13 +229,14 @@ type RegistrationEvent struct {
228229 ImageProofPayment string `json:"image_proof_payment"`
229230 PaymentDate null.Time `json:"payment_date"`
230231 Status string `json:"status"` // register, pay, approve/cancel/decline
231- UpToYou string `json:"up_to_you "`
232- CreatedByUserID int `json:"created_by_user_id "`
233- UpdatedByUserID int `json:"updated_by_user_id "`
234- DeletedByUserID int `json:"deleted_by_user_id "`
232+ UpToYou string `json:"- "`
233+ CreatedByUserID int `json:"- "`
234+ UpdatedByUserID int `json:"- "`
235+ DeletedByUserID int `json:"- "`
235236 CreatedAt time.Time `json:"created_at"`
236- UpdatedAt null.Time `json:"updated_at"`
237- DeletedAt null.Time `json:"deleted_at"`
237+ UpdatedAt null.Time `json:"-"`
238+ DeletedAt null.Time `json:"-"`
239+ Event Event `json:"event_detail" gorm:"foreignKey:EventID"`
238240}
239241
240242func (RegistrationEvent ) TableName () string {
0 commit comments