Removed unnecesary bloat

This commit is contained in:
cdricms
2025-01-14 15:14:31 +01:00
parent 1f83cf25f5
commit 77fe6a5fab
3 changed files with 30 additions and 19 deletions

View File

@@ -1,9 +1,9 @@
package main
import (
"time"
"github.com/uptrace/bun"
"github.com/google/uuid"
"github.com/uptrace/bun"
"time"
)
type Role string
@@ -16,24 +16,24 @@ const (
type User struct {
bun.BaseModel `bun:"table:users"`
ID uuid.UUID `bun:"type:uuid,pk,default:gen_random_uuid()"`
FirstName string `bun:"firstname,notnull"`
LastName string `bun:"lastname,notnull"`
Email string `bun:"email,unique,notnull"`
Phone string `bun:"phone,notnull"`
Role Role `bun:"role,notnull,default:'user'"`
ID uuid.UUID `bun:"type:uuid,pk,default:gen_random_uuid()"`
FirstName string `bun:"firstname,notnull"`
LastName string `bun:"lastname,notnull"`
Email string `bun:"email,unique,notnull"`
Phone string `bun:"phone,notnull"`
Role Role `bun:"role,notnull,default:'user'"`
CreatedAt time.Time `bun:"created_at,default:current_timestamp"`
UpdatedAt time.Time `bun:"updated_at,default:current_timestamp"`
UpdatedAt time.Time `bun:"updated_at,default:current_timestamp"`
}
type Event struct {
bun.BaseModel `bun:"table:events"`
EventID uuid.UUID `bun:"type:uuid,pk"`
CreationDate time.Time `bun:"creation_date,notnull,default:current_timestamp"`
EventID uuid.UUID `bun:"type:uuid,pk"`
CreationDate time.Time `bun:"creation_date,notnull,default:current_timestamp"`
ScheduleStart time.Time `bun:"schedule_start,notnull"`
ScheduleEnd time.Time `bun:"schedule_end,notnull"`
Status string `bun:"status,notnull"`
Status string `bun:"status,notnull"`
}
type EventsToUsers struct {
@@ -42,8 +42,8 @@ type EventsToUsers struct {
EventID uuid.UUID `bun:"type:uuid,notnull"`
UserID uuid.UUID `bun:"type:uuid,notnull"`
Event *Event `bun:"rel:belongs_to,join:event_id=event_id"`
User *User `bun:"rel:belongs_to,join:user_id=user_id"`
Event *Event `bun:"rel:belongs_to,join:event_id=event_id"`
User *User `bun:"rel:belongs_to,join:user_id=user_id"`
PrimaryKey struct {
EventID uuid.UUID `bun:"pk"`
@@ -70,6 +70,6 @@ type Blog struct {
type WebsiteSettings struct {
bun.BaseModel `bun:"table:website_settings"`
ID uuid.UUID `bun:"type:uuid,pk,default:gen_random_uuid()"`
AutoAcceptDemand bool `bun:"auto_accept_demand,default:false"`
ID uuid.UUID `bun:"type:uuid,pk,default:gen_random_uuid()"`
AutoAcceptDemand bool `bun:"auto_accept_demand,default:false"`
}