Add quota and limit for events
Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
@@ -141,6 +141,21 @@ func (self *Attendance) GetAttendanceListByEventId(ctx context.Context, eventId
|
||||
return &result, err
|
||||
}
|
||||
|
||||
func (self *Attendance) CountUsersByEventID(ctx context.Context, eventID uuid.UUID) (int64, error) {
|
||||
var count int64
|
||||
|
||||
err := Database.WithContext(ctx).
|
||||
Model(&Attendance{}).
|
||||
Where("event_id = ?", eventID).
|
||||
Count(&count).Error
|
||||
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return count, nil
|
||||
}
|
||||
|
||||
func (self *Attendance) Update(ctx context.Context, attendanceId uuid.UUID) (*Attendance, error) {
|
||||
var attendance Attendance
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@ type Event struct {
|
||||
Thumbnail string `json:"thumbnail" gorm:"type:varchar(255)"`
|
||||
Owner uuid.UUID `json:"owner" gorm:"type:uuid;index;not null"`
|
||||
EnableKYC bool `json:"enable_kyc" gorm:"not null"`
|
||||
Quota int64 `json:"quota" gorm:"not null"`
|
||||
Limit int64 `json:"limit" gorm:"not null"`
|
||||
}
|
||||
|
||||
type EventIndexDoc struct {
|
||||
|
||||
Reference in New Issue
Block a user