From 77fe6a5fab30be33050667472228f65b99494b43 Mon Sep 17 00:00:00 2001 From: cdricms <36056008+cdricms@users.noreply.github.com> Date: Tue, 14 Jan 2025 15:14:31 +0100 Subject: [PATCH] Removed unnecesary bloat --- backend/go.mod | 9 ++++++--- backend/go.sum | 8 ++++++++ backend/schemas.go | 32 ++++++++++++++++---------------- 3 files changed, 30 insertions(+), 19 deletions(-) diff --git a/backend/go.mod b/backend/go.mod index 857f398..8fd8cf1 100644 --- a/backend/go.mod +++ b/backend/go.mod @@ -3,12 +3,15 @@ module fr.latosa-escrima go 1.23.4 require ( - github.com/google/uuid v1.6.0 // indirect + github.com/google/uuid v1.6.0 + github.com/joho/godotenv v1.5.1 + github.com/uptrace/bun v1.2.8 +) + +require ( github.com/jinzhu/inflection v1.0.0 // indirect - github.com/joho/godotenv v1.5.1 // indirect github.com/puzpuzpuz/xsync/v3 v3.4.0 // indirect github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect - github.com/uptrace/bun v1.2.8 // indirect github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect golang.org/x/sys v0.29.0 // indirect diff --git a/backend/go.sum b/backend/go.sum index bfd2319..3559df7 100644 --- a/backend/go.sum +++ b/backend/go.sum @@ -1,11 +1,17 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/puzpuzpuz/xsync/v3 v3.4.0 h1:DuVBAdXuGFHv8adVXjWWZ63pJq+NRXOWVXlKDBZ+mJ4= github.com/puzpuzpuz/xsync/v3 v3.4.0/go.mod h1:VjzYrABPabuM4KyBh1Ftq6u8nhwY5tBPKP9jpmh0nnA= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo= github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs= github.com/uptrace/bun v1.2.8 h1:HEiLvy9wc7ehU5S02+O6NdV5BLz48lL4REPhTkMX3Dg= @@ -16,3 +22,5 @@ github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAh github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/backend/schemas.go b/backend/schemas.go index 6c61ba2..b6f618b 100644 --- a/backend/schemas.go +++ b/backend/schemas.go @@ -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"` }