Add quota and limit for events

Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
2026-02-05 12:53:54 +08:00
parent 2ad3ba2400
commit 6504c20708
5 changed files with 57 additions and 3 deletions

View File

@@ -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

View File

@@ -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 {