55 "net/http"
66 "time"
77
8+ "github.com/hammer-code/lms-be/constants"
89 "gopkg.in/guregu/null.v4"
910)
1011
@@ -68,21 +69,23 @@ type Event struct {
6869 Author User `gorm:"foreignKey:AuthorID;references:ID"` // Ensure foreign key is correctly referenced
6970 Image string `json:"image"`
7071 Date null.Time `json:"date"`
71- Type string `json:"type"`
72+ Type constants. EventType `json:"type"`
7273 Location string `json:"location"`
7374 Duration string `json:"duration"`
7475 Capacity int `json:"capacity"`
75- Status string `json:"status"` // Conference, Tech Talk, Workshop, Webinar, etc.
76- Tags []EventTag `gorm:"foreignKey:EventID;constraint:OnDelete:CASCADE;"` // Ensure foreign key is correctly referenced
77- Speakers []EventSpeaker `gorm:"foreignKey:EventID;constraint:OnDelete:CASCADE;"` // Ensure foreign key is correctly referenced
78- SessionType string `json:"session_type"` // online, offline, hybrid
76+ Status string `json:"status"`
77+ Tags []EventTag `json:"tags" gorm:"foreignKey:EventID;constraint:OnDelete:CASCADE;"`
78+ Speakers []EventSpeaker `json:"speakers" gorm:"foreignKey:EventID;constraint:OnDelete:CASCADE;"`
7979 RegistrationLink string `json:"registration_link"`
8080 Price float64 `json:"price"` // 0 == free
81+ CreatedBy int `json:"-"`
82+ UpdatedBy int `json:"-"`
83+ DeletedBy int `json:"-"`
8184 ReservationStartDate null.Time `json:"reservation_start_date"`
8285 ReservationEndDate null.Time `json:"reservation_end_date"`
8386 CreatedAt time.Time `json:"created_at"`
84- UpdatedAt null.Time `json:"updated_at "`
85- DeletedAt null.Time `json:"deleted_at "`
87+ UpdatedAt null.Time `json:"- "`
88+ DeletedAt null.Time `json:"- "`
8689 AdditionalLink string `json:"additional_link"`
8790}
8891
@@ -118,7 +121,7 @@ type CreateEventPayload struct {
118121 Slug string `json:"slug" validate:"required"`
119122 IsOnline string `json:"is_online" validate:"required"`
120123 Date null.Time `json:"date" validate:"required"`
121- Type string `json:"type" validate:"required"`
124+ Type constants. EventType `json:"type" validate:"required"`
122125 Location string `json:"location" validate:"required"`
123126 Duration string `json:"duration" validate:"required"`
124127 Status string `json:"status" validate:"required"`
@@ -140,7 +143,7 @@ type UpdateEventPayload struct {
140143 Slug string `json:"slug" validate:"required"`
141144 IsOnline string `json:"is_online" validate:"required"`
142145 Date null.Time `json:"date" validate:"required"`
143- Type string `json:"type" validate:"required"`
146+ Type constants. EventType `json:"type" validate:"required"`
144147 Location string `json:"location" validate:"required"`
145148 Duration string `json:"duration" validate:"required"`
146149 Status string `json:"status" validate:"required"`
@@ -155,29 +158,17 @@ type UpdateEventPayload struct {
155158}
156159
157160type EventDTO struct {
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"`
161+ ID int `json:"id"`
162+ Title string `json:"title"`
163+ Description string `json:"description"`
164+ Author string `json:"author"`
165+ ImageEvent string `json:"image_event"`
166+ DateEvent null.Time `json:"date_event"`
167+ Type constants.EventType `json:"type"`
168+ Location string `json:"location"`
169+ Duration string `json:"duration"`
170+ Capacity int `json:"capacity"`
171+ RegistrationLink string `json:"registration_link"`
181172}
182173
183174type UpdateEvenPayload struct {
@@ -186,7 +177,7 @@ type UpdateEvenPayload struct {
186177 Author string `json:"author"`
187178 ImageEvent string `json:"image_event"`
188179 DateEvent null.Time `json:"date_event"`
189- Type string `json:"type"`
180+ Type constants. EventType `json:"type"`
190181 Location string `json:"location"`
191182 Duration string `json:"duration"`
192183 Capacity int `json:"capacity"`
@@ -196,7 +187,7 @@ type UpdateEvenPayload struct {
196187type EventFilter struct {
197188 ID uint
198189 Title string
199- Type string
190+ Type constants. EventType
200191 Status string
201192 StartDate null.Time
202193 EndDate null.Time
@@ -236,9 +227,14 @@ type RegistrationEvent struct {
236227 ImageProofPayment string `json:"image_proof_payment"`
237228 PaymentDate null.Time `json:"payment_date"`
238229 Status string `json:"status"` // register, pay, approve/cancel/decline
230+ UpToYou string `json:"-"`
231+ CreatedByUserID int `json:"-"`
232+ UpdatedByUserID int `json:"-"`
233+ DeletedByUserID int `json:"-"`
239234 CreatedAt time.Time `json:"created_at"`
240- UpdatedAt null.Time `json:"updated_at"`
241- DeletedAt null.Time `json:"deleted_at"`
235+ UpdatedAt null.Time `json:"-"`
236+ DeletedAt null.Time `json:"-"`
237+ Event Event `json:"event_detail" gorm:"foreignKey:EventID"`
242238}
243239
244240func (RegistrationEvent ) TableName () string {
0 commit comments