From 3676427ad5e6aced2b3813b04bf7cac436320d82 Mon Sep 17 00:00:00 2001 From: David Oduneye Date: Sun, 21 Apr 2024 13:41:33 -0400 Subject: [PATCH] feat: defined sql files for schema --- backend/src/database/db.go | 11 ++++++-- backend/src/middleware/auth.go | 2 +- backend/src/migrations/categories.sql | 11 ++++++++ backend/src/migrations/club_events.sql | 9 +++++++ backend/src/migrations/club_tags.sql | 9 +++++++ backend/src/migrations/clubs.sql | 21 ++++++++++++++++ backend/src/migrations/contacts.sql | 14 +++++++++++ backend/src/migrations/event_series.sql | 8 ++++++ backend/src/migrations/event_tags.sql | 9 +++++++ backend/src/migrations/events.sql | 19 ++++++++++++++ backend/src/migrations/files.sql | 17 +++++++++++++ backend/src/migrations/notifications.sql | 13 ++++++++++ backend/src/migrations/point_of_contact.sql | 16 ++++++++++++ backend/src/migrations/series.sql | 10 ++++++++ backend/src/migrations/tags.sql | 11 ++++++++ backend/src/migrations/user.sql | 25 +++++++++++++++++++ .../src/migrations/user_club_followers.sql | 9 +++++++ .../user_club_intended_applicants.sql | 9 +++++++ backend/src/migrations/user_club_members.sql | 10 ++++++++ backend/src/migrations/user_event_rsvp.sql | 9 +++++++ .../src/migrations/user_event_waitlist.sql | 9 +++++++ backend/src/migrations/user_tags.sql | 9 +++++++ backend/src/migrations/verifications.sql | 10 ++++++++ backend/src/models/user.go | 17 ++++++------- 24 files changed, 275 insertions(+), 12 deletions(-) create mode 100644 backend/src/migrations/categories.sql create mode 100644 backend/src/migrations/club_events.sql create mode 100644 backend/src/migrations/club_tags.sql create mode 100644 backend/src/migrations/clubs.sql create mode 100644 backend/src/migrations/contacts.sql create mode 100644 backend/src/migrations/event_series.sql create mode 100644 backend/src/migrations/event_tags.sql create mode 100644 backend/src/migrations/events.sql create mode 100644 backend/src/migrations/files.sql create mode 100644 backend/src/migrations/notifications.sql create mode 100644 backend/src/migrations/point_of_contact.sql create mode 100644 backend/src/migrations/series.sql create mode 100644 backend/src/migrations/tags.sql create mode 100644 backend/src/migrations/user.sql create mode 100644 backend/src/migrations/user_club_followers.sql create mode 100644 backend/src/migrations/user_club_intended_applicants.sql create mode 100644 backend/src/migrations/user_club_members.sql create mode 100644 backend/src/migrations/user_event_rsvp.sql create mode 100644 backend/src/migrations/user_event_waitlist.sql create mode 100644 backend/src/migrations/user_tags.sql create mode 100644 backend/src/migrations/verifications.sql diff --git a/backend/src/database/db.go b/backend/src/database/db.go index 10359b8b3..fdc476057 100644 --- a/backend/src/database/db.go +++ b/backend/src/database/db.go @@ -14,8 +14,15 @@ func ConfigureDB(settings config.Settings) (*gorm.DB, error) { return nil, err } - if err := MigrateDB(settings, db); err != nil { - return nil, err + // if err := MigrateDB(settings, db); err != nil { + // return nil, err + // } + + var superUser models.User + if err := db.Where("role = ?", models.Super).First(&superUser).Error; err != nil { + if err := createSuperUser(settings, db); err != nil { + return nil, err + } } return db, nil diff --git a/backend/src/middleware/auth.go b/backend/src/middleware/auth.go index 8b763d5f1..a873ef9c2 100644 --- a/backend/src/middleware/auth.go +++ b/backend/src/middleware/auth.go @@ -21,7 +21,7 @@ func getExcludedPaths() []map[string]string { {"/api/v1/auth/login": "POST"}, {"/api/v1/auth/logout": "POST"}, {"/api/v1/auth/refresh": "POST"}, - {"/api/v1/auth/send-code/": "POST"}, + {"/api/v1/auth/send-code": "POST"}, {"/api/v1/auth/verify-email": "POST"}, {"/api/v1/auth/verify-reset": "POST"}, {"/api/v1/auth/forgot-password": "POST"}, diff --git a/backend/src/migrations/categories.sql b/backend/src/migrations/categories.sql new file mode 100644 index 000000000..d4e4cd68e --- /dev/null +++ b/backend/src/migrations/categories.sql @@ -0,0 +1,11 @@ +DROP TABLE IF EXISTS categories; + +CREATE TABLE categories( + id uuid NOT NULL DEFAULT uuid_generate_v4(), + created_at timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, + name varchar(255) NOT NULL, + PRIMARY KEY(id) +); + +CREATE UNIQUE INDEX uni_categories_name ON categories USING btree ("name"); \ No newline at end of file diff --git a/backend/src/migrations/club_events.sql b/backend/src/migrations/club_events.sql new file mode 100644 index 000000000..3f44f384d --- /dev/null +++ b/backend/src/migrations/club_events.sql @@ -0,0 +1,9 @@ +DROP TABLE IF EXISTS club_events CASCADE; + +CREATE TABLE club_events( + club_id uuid NOT NULL DEFAULT uuid_generate_v4(), + event_id uuid NOT NULL DEFAULT uuid_generate_v4(), + PRIMARY KEY(club_id,event_id), + CONSTRAINT fk_club_events_event FOREIGN key(event_id) REFERENCES events(id), + CONSTRAINT fk_club_events_club FOREIGN key(club_id) REFERENCES clubs(id) +); \ No newline at end of file diff --git a/backend/src/migrations/club_tags.sql b/backend/src/migrations/club_tags.sql new file mode 100644 index 000000000..eea974802 --- /dev/null +++ b/backend/src/migrations/club_tags.sql @@ -0,0 +1,9 @@ +DROP TABLE IF EXISTS club_tags; + +CREATE TABLE club_tags( + tag_id uuid NOT NULL DEFAULT uuid_generate_v4(), + club_id uuid NOT NULL DEFAULT uuid_generate_v4(), + PRIMARY KEY(tag_id,club_id), + CONSTRAINT fk_club_tags_tag FOREIGN key(tag_id) REFERENCES tags(id), + CONSTRAINT fk_club_tags_club FOREIGN key(club_id) REFERENCES clubs(id) +); \ No newline at end of file diff --git a/backend/src/migrations/clubs.sql b/backend/src/migrations/clubs.sql new file mode 100644 index 000000000..efa074c40 --- /dev/null +++ b/backend/src/migrations/clubs.sql @@ -0,0 +1,21 @@ +DROP TABLE IF EXISTS clubs; + +CREATE TABLE clubs( + id uuid NOT NULL DEFAULT uuid_generate_v4(), + created_at timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, + soft_deleted_at timestamp with time zone, + name varchar(255) NOT NULL, + preview varchar(255) NOT NULL, + description text NOT NULL, + num_members bigint NOT NULL, + is_recruiting boolean NOT NULL DEFAULT false, + recruitment_cycle varchar(255) NOT NULL DEFAULT 'always'::character varying, + recruitment_type varchar(255) NOT NULL DEFAULT 'unrestricted'::character varying, + weekly_time_commitment bigint, + one_word_to_describe_us varchar(255) DEFAULT NULL::character varying, + application_link varchar(255) DEFAULT NULL::character varying, + logo varchar(255) DEFAULT NULL::character varying, + parent text, + PRIMARY KEY(id) +); \ No newline at end of file diff --git a/backend/src/migrations/contacts.sql b/backend/src/migrations/contacts.sql new file mode 100644 index 000000000..94baf54bc --- /dev/null +++ b/backend/src/migrations/contacts.sql @@ -0,0 +1,14 @@ +DROP TABLE IF EXISTS contacts; + +CREATE TABLE contacts( + id uuid NOT NULL DEFAULT uuid_generate_v4(), + created_at timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, + "type" varchar(255) NOT NULL, + content varchar(255) NOT NULL, + club_id uuid NOT NULL, + PRIMARY KEY(id), + CONSTRAINT fk_clubs_contact FOREIGN key(club_id) REFERENCES clubs(id) +); + +CREATE UNIQUE INDEX idx_contact_type ON contacts USING btree ("type","club_id"); \ No newline at end of file diff --git a/backend/src/migrations/event_series.sql b/backend/src/migrations/event_series.sql new file mode 100644 index 000000000..56a5bac2f --- /dev/null +++ b/backend/src/migrations/event_series.sql @@ -0,0 +1,8 @@ +DROP TABLE IF EXISTS event_series; + +CREATE TABLE event_series( + event_id uuid NOT NULL, + series_id uuid NOT NULL, + CONSTRAINT fk_event_series_event FOREIGN key(event_id) REFERENCES events(id), + CONSTRAINT fk_event_series_series FOREIGN key(series_id) REFERENCES series(id) +); \ No newline at end of file diff --git a/backend/src/migrations/event_tags.sql b/backend/src/migrations/event_tags.sql new file mode 100644 index 000000000..934000922 --- /dev/null +++ b/backend/src/migrations/event_tags.sql @@ -0,0 +1,9 @@ +DROP TABLE IF EXISTS event_tags; + +CREATE TABLE event_tags( + tag_id uuid NOT NULL DEFAULT uuid_generate_v4(), + event_id uuid NOT NULL DEFAULT uuid_generate_v4(), + PRIMARY KEY(tag_id,event_id), + CONSTRAINT fk_event_tags_tag FOREIGN key(tag_id) REFERENCES tags(id), + CONSTRAINT fk_event_tags_event FOREIGN key(event_id) REFERENCES events(id) +); \ No newline at end of file diff --git a/backend/src/migrations/events.sql b/backend/src/migrations/events.sql new file mode 100644 index 000000000..13c00db8b --- /dev/null +++ b/backend/src/migrations/events.sql @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS events; + +CREATE TABLE events( + id uuid NOT NULL DEFAULT uuid_generate_v4(), + created_at timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, + name varchar(255) NOT NULL, + preview varchar(255) NOT NULL, + content text NOT NULL, + start_time timestamp with time zone NOT NULL, + end_time timestamp with time zone NOT NULL, + location varchar(255) NOT NULL, + event_type varchar(255) NOT NULL DEFAULT 'open'::character varying, + is_recurring boolean NOT NULL DEFAULT false, + meeting_link varchar(255), + host uuid NOT NULL, + PRIMARY KEY(id), + CONSTRAINT fk_clubs_host_event FOREIGN key(host) REFERENCES clubs(id) +); \ No newline at end of file diff --git a/backend/src/migrations/files.sql b/backend/src/migrations/files.sql new file mode 100644 index 000000000..33096c84e --- /dev/null +++ b/backend/src/migrations/files.sql @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS files; + +CREATE TABLE files( + id uuid NOT NULL DEFAULT uuid_generate_v4(), + created_at timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, + owner_id uuid NOT NULL, + owner_type varchar(255) NOT NULL, + file_name varchar(255) NOT NULL, + file_type varchar(255) NOT NULL, + file_size bigint NOT NULL, + file_url varchar(255) NOT NULL, + object_key varchar(255) NOT NULL, + PRIMARY KEY(id) +); +CREATE INDEX idx_files_owner_type ON files USING btree ("owner_type"); +CREATE INDEX idx_files_owner_id ON files USING btree ("owner_id"); \ No newline at end of file diff --git a/backend/src/migrations/notifications.sql b/backend/src/migrations/notifications.sql new file mode 100644 index 000000000..054a880ea --- /dev/null +++ b/backend/src/migrations/notifications.sql @@ -0,0 +1,13 @@ +-- CREATE TABLE notifications( +-- id uuid NOT NULL DEFAULT uuid_generate_v4(), +-- created_at timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, +-- updated_at timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, +-- send_at timestamp with time zone NOT NULL, +-- title varchar(255) NOT NULL, +-- content varchar(255) NOT NULL, +-- deep_link varchar(255) NOT NULL, +-- icon varchar(255) NOT NULL, +-- reference_id uuid NOT NULL, +-- reference_type varchar(255) NOT NULL, +-- PRIMARY KEY(id) +-- ); \ No newline at end of file diff --git a/backend/src/migrations/point_of_contact.sql b/backend/src/migrations/point_of_contact.sql new file mode 100644 index 000000000..9b9eb9a08 --- /dev/null +++ b/backend/src/migrations/point_of_contact.sql @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS point_of_contacts; + +CREATE TABLE point_of_contacts( + id uuid NOT NULL DEFAULT uuid_generate_v4(), + created_at timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, + name varchar(255) NOT NULL, + email varchar(255) NOT NULL, + position varchar(255) NOT NULL, + club_id uuid NOT NULL, + PRIMARY KEY(id), + CONSTRAINT fk_clubs_point_of_contact FOREIGN key(club_id) REFERENCES clubs(id) +); +CREATE UNIQUE INDEX compositeindex ON point_of_contacts USING btree ("email","club_id"); +CREATE INDEX idx_point_of_contacts_club_id ON point_of_contacts USING btree ("club_id"); +CREATE INDEX idx_point_of_contacts_email ON point_of_contacts USING btree ("email"); \ No newline at end of file diff --git a/backend/src/migrations/series.sql b/backend/src/migrations/series.sql new file mode 100644 index 000000000..2e7fb1da3 --- /dev/null +++ b/backend/src/migrations/series.sql @@ -0,0 +1,10 @@ +DROP TABLE IF EXISTS series; + +CREATE TABLE series( + id uuid NOT NULL DEFAULT uuid_generate_v4(), + created_at timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, + recurring_type varchar(255) NOT NULL DEFAULT 'open'::character varying, + max_occurrences bigint NOT NULL, + PRIMARY KEY(id) +); \ No newline at end of file diff --git a/backend/src/migrations/tags.sql b/backend/src/migrations/tags.sql new file mode 100644 index 000000000..ba083f5d6 --- /dev/null +++ b/backend/src/migrations/tags.sql @@ -0,0 +1,11 @@ +DROP TABLE IF EXISTS tags; + +CREATE TABLE tags( + id uuid NOT NULL DEFAULT uuid_generate_v4(), + created_at timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, + name varchar(255) NOT NULL, + category_id uuid NOT NULL, + PRIMARY KEY(id), + CONSTRAINT fk_categories_tag FOREIGN key(category_id) REFERENCES categories(id) +); \ No newline at end of file diff --git a/backend/src/migrations/user.sql b/backend/src/migrations/user.sql new file mode 100644 index 000000000..2bf728f4b --- /dev/null +++ b/backend/src/migrations/user.sql @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS users; + +-- Create User table +CREATE TABLE users( + id uuid NOT NULL DEFAULT uuid_generate_v4(), + created_at timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, + role varchar(255) NOT NULL DEFAULT 'student'::character varying, + first_name varchar(255) NOT NULL, + last_name varchar(255) NOT NULL, + email varchar(255) NOT NULL, + password_hash varchar(97) NOT NULL, + major0 varchar(255), + major1 varchar(255), + major2 varchar(255), + college varchar(255), + graduation_cycle varchar(255), + graduation_year smallint, + is_verified boolean NOT NULL DEFAULT false, + PRIMARY KEY(id) +); + +CREATE UNIQUE INDEX uni_users_email ON users USING btree ("email"); + +-- Insert sample data into "users" table \ No newline at end of file diff --git a/backend/src/migrations/user_club_followers.sql b/backend/src/migrations/user_club_followers.sql new file mode 100644 index 000000000..2d9350e97 --- /dev/null +++ b/backend/src/migrations/user_club_followers.sql @@ -0,0 +1,9 @@ +DROP TABLE IF EXISTS user_club_followers; + +CREATE TABLE user_club_followers( + user_id uuid NOT NULL DEFAULT uuid_generate_v4(), + club_id uuid NOT NULL DEFAULT uuid_generate_v4(), + PRIMARY KEY(user_id,club_id), + CONSTRAINT fk_user_club_followers_user FOREIGN key(user_id) REFERENCES users(id), + CONSTRAINT fk_user_club_followers_club FOREIGN key(club_id) REFERENCES clubs(id) +); \ No newline at end of file diff --git a/backend/src/migrations/user_club_intended_applicants.sql b/backend/src/migrations/user_club_intended_applicants.sql new file mode 100644 index 000000000..df766ab7a --- /dev/null +++ b/backend/src/migrations/user_club_intended_applicants.sql @@ -0,0 +1,9 @@ +DROP TABLE IF EXISTS user_club_intended_applicants; + +CREATE TABLE user_club_intended_applicants( + user_id uuid NOT NULL DEFAULT uuid_generate_v4(), + club_id uuid NOT NULL DEFAULT uuid_generate_v4(), + PRIMARY KEY(user_id,club_id), + CONSTRAINT fk_user_club_intended_applicants_user FOREIGN key(user_id) REFERENCES users(id), + CONSTRAINT fk_user_club_intended_applicants_club FOREIGN key(club_id) REFERENCES clubs(id) +); \ No newline at end of file diff --git a/backend/src/migrations/user_club_members.sql b/backend/src/migrations/user_club_members.sql new file mode 100644 index 000000000..f871ad5f2 --- /dev/null +++ b/backend/src/migrations/user_club_members.sql @@ -0,0 +1,10 @@ +DROP TABLE IF EXISTS user_club_members; + +CREATE TABLE user_club_members( + user_id uuid NOT NULL, + club_id uuid NOT NULL, + membership_type varchar(255) NOT NULL DEFAULT 'member'::character varying, + PRIMARY KEY(user_id,club_id), + CONSTRAINT fk_user_club_members_user FOREIGN key(user_id) REFERENCES users(id), + CONSTRAINT fk_user_club_members_club FOREIGN key(club_id) REFERENCES clubs(id) +); \ No newline at end of file diff --git a/backend/src/migrations/user_event_rsvp.sql b/backend/src/migrations/user_event_rsvp.sql new file mode 100644 index 000000000..907571f2e --- /dev/null +++ b/backend/src/migrations/user_event_rsvp.sql @@ -0,0 +1,9 @@ +DROP TABLE IF EXISTS user_event_rsvps; + +CREATE TABLE user_event_rsvps( + user_id uuid NOT NULL DEFAULT uuid_generate_v4(), + event_id uuid NOT NULL DEFAULT uuid_generate_v4(), + PRIMARY KEY(user_id,event_id), + CONSTRAINT fk_user_event_rsvps_user FOREIGN key(user_id) REFERENCES users(id), + CONSTRAINT fk_user_event_rsvps_event FOREIGN key(event_id) REFERENCES events(id) +); \ No newline at end of file diff --git a/backend/src/migrations/user_event_waitlist.sql b/backend/src/migrations/user_event_waitlist.sql new file mode 100644 index 000000000..97143ec8f --- /dev/null +++ b/backend/src/migrations/user_event_waitlist.sql @@ -0,0 +1,9 @@ +DROP TABLE IF EXISTS user_event_waitlists; + +CREATE TABLE user_event_waitlists( + user_id uuid NOT NULL DEFAULT uuid_generate_v4(), + event_id uuid NOT NULL DEFAULT uuid_generate_v4(), + PRIMARY KEY(user_id,event_id), + CONSTRAINT fk_user_event_waitlists_user FOREIGN key(user_id) REFERENCES users(id), + CONSTRAINT fk_user_event_waitlists_event FOREIGN key(event_id) REFERENCES events(id) +); \ No newline at end of file diff --git a/backend/src/migrations/user_tags.sql b/backend/src/migrations/user_tags.sql new file mode 100644 index 000000000..31b82b29f --- /dev/null +++ b/backend/src/migrations/user_tags.sql @@ -0,0 +1,9 @@ +DROP TABLE IF EXISTS user_tags; + +CREATE TABLE user_tags( + user_id uuid NOT NULL DEFAULT uuid_generate_v4(), + tag_id uuid NOT NULL DEFAULT uuid_generate_v4(), + PRIMARY KEY(user_id,tag_id), + CONSTRAINT fk_user_tags_user FOREIGN key(user_id) REFERENCES users(id), + CONSTRAINT fk_user_tags_tag FOREIGN key(tag_id) REFERENCES tags(id) +); \ No newline at end of file diff --git a/backend/src/migrations/verifications.sql b/backend/src/migrations/verifications.sql new file mode 100644 index 000000000..344ea8913 --- /dev/null +++ b/backend/src/migrations/verifications.sql @@ -0,0 +1,10 @@ +DROP TABLE IF EXISTS verifications CASCADE; + +CREATE TABLE verifications( + user_id varchar(36) NOT NULL, + token varchar(255), + expires_at timestamp without time zone NOT NULL, + "type" varchar(255) NOT NULL, + PRIMARY KEY(user_id,expires_at) +); +CREATE UNIQUE INDEX uni_verifications_token ON verifications USING btree ("token"); \ No newline at end of file diff --git a/backend/src/models/user.go b/backend/src/models/user.go index 39b27baf8..abd9e145c 100644 --- a/backend/src/models/user.go +++ b/backend/src/models/user.go @@ -160,15 +160,14 @@ type User struct { GraduationYear int16 `gorm:"type:smallint;" json:"graduation_year" validate:"required"` IsVerified bool `gorm:"type:boolean;default:false;not null" json:"is_verified"` - Tag []Tag `gorm:"many2many:user_tags;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-" validate:"-"` - Admin []Club `gorm:"many2many:user_club_admins;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-" validate:"-"` - Member []Club `gorm:"many2many:user_club_members;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-" validate:"-"` - Follower []Club `gorm:"many2many:user_club_followers;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-" validate:"-"` - IntendedApplicant []Club `gorm:"many2many:user_club_intended_applicants;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-" validate:"-"` - Asked []Comment `gorm:"foreignKey:AskedByID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;" json:"-" validate:"-"` - Answered []Comment `gorm:"foreignKey:AnsweredByID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;" json:"-" validate:"-"` - RSVP []Event `gorm:"many2many:user_event_rsvps;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-" validate:"-"` - Waitlist []Event `gorm:"many2many:user_event_waitlists;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-" validate:"-"` + Tag []Tag `gorm:"many2many:user_tags;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-" validate:"-"` + Member []Club `gorm:"many2many:user_club_members;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-" validate:"-"` + Follower []Club `gorm:"many2many:user_club_followers;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-" validate:"-"` + // IntendedApplicant []Club `gorm:"many2many:user_club_intended_applicants;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-" validate:"-"` + // Asked []Comment `gorm:"foreignKey:AskedByID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;" json:"-" validate:"-"` + // Answered []Comment `gorm:"foreignKey:AnsweredByID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;" json:"-" validate:"-"` + RSVP []Event `gorm:"many2many:user_event_rsvps;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-" validate:"-"` + Waitlist []Event `gorm:"many2many:user_event_waitlists;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-" validate:"-"` } type CreateUserRequestBody struct {