@@ -42,15 +42,17 @@ type Challenge struct {
4242
4343type User struct {
4444 bun.BaseModel ` bun:"table:users"`
45- ID int64 ` bun:",pk,autoincrement"`
46- Email string ` bun:",unique,notnull"`
47- Username string ` bun:",unique,notnull"`
48- PasswordHash string ` bun:",notnull"`
49- Role string ` bun:",notnull"`
50- TeamID int64 ` bun:"team_id,notnull"`
51- TeamName string ` bun:"team_name,scanonly"`
52- CreatedAt time.Time ` bun:",nullzero,notnull,default:current_timestamp"`
53- UpdatedAt time.Time ` bun:",nullzero,notnull,default:current_timestamp"`
45+ ID int64 ` bun:"id,pk,autoincrement"`
46+ Email string ` bun:"email,unique,notnull"`
47+ Username string ` bun:"username,unique,notnull"`
48+ PasswordHash string ` bun:"password_hash,notnull"`
49+ Role string ` bun:"role,notnull"`
50+ TeamID int64 ` bun:"team_id,notnull"`
51+ TeamName string ` bun:"team_name,scanonly"`
52+ BlockedReason *string ` bun:"blocked_reason,nullzero"`
53+ BlockedAt *time.Time ` bun:"blocked_at,nullzero"`
54+ CreatedAt time.Time ` bun:"created_at,nullzero,notnull,default:current_timestamp"`
55+ UpdatedAt time.Time ` bun:"updated_at,nullzero,notnull,default:current_timestamp"`
5456}
5557
5658type Team struct {
@@ -73,14 +75,22 @@ type Submission struct {
7375
7476type RegistrationKey struct {
7577 bun.BaseModel ` bun:"table:registration_keys"`
76- ID int64 ` bun:",pk,autoincrement"`
77- Code string ` bun:",unique,notnull"`
78- CreatedBy int64 ` bun:",notnull"`
79- TeamID int64 ` bun:"team_id,notnull"`
80- UsedBy *int64 ` bun:",nullzero"`
81- UsedByIP *string ` bun:",nullzero"`
82- CreatedAt time.Time ` bun:",nullzero,notnull,default:current_timestamp"`
83- UsedAt *time.Time ` bun:",nullzero"`
78+ ID int64 ` bun:"id,pk,autoincrement"`
79+ Code string ` bun:"code,unique,notnull"`
80+ CreatedBy int64 ` bun:"created_by,notnull"`
81+ TeamID int64 ` bun:"team_id,notnull"`
82+ MaxUses int ` bun:"max_uses,notnull,default:1"`
83+ UsedCount int ` bun:"used_count,notnull,default:0"`
84+ CreatedAt time.Time ` bun:"created_at,nullzero,notnull,default:current_timestamp"`
85+ }
86+
87+ type RegistrationKeyUse struct {
88+ bun.BaseModel ` bun:"table:registration_key_uses"`
89+ ID int64 ` bun:"id,pk,autoincrement"`
90+ RegistrationKeyID int64 ` bun:"registration_key_id,notnull"`
91+ UsedBy int64 ` bun:"used_by,notnull"`
92+ UsedByIP string ` bun:"used_by_ip,notnull"`
93+ UsedAt time.Time ` bun:"used_at,nullzero,notnull,default:current_timestamp"`
8494}
8595
8696type Stack struct {
0 commit comments