-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f000888
commit 6a5fc56
Showing
24 changed files
with
311 additions
and
200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,20 @@ | ||
package models | ||
|
||
import ( | ||
"github.com/GenerateNU/sac/backend/src/types" | ||
) | ||
import "github.com/google/uuid" | ||
|
||
type Comment struct { | ||
types.Model | ||
Model | ||
|
||
Question string `gorm:"type:varchar(255)" json:"question" validate:"required,max=255"` | ||
Answer string `gorm:"type:varchar(255)" json:"answer" validate:",max=255"` | ||
NumFoundHelpful uint `gorm:"type:int;default:0" json:"num_found_helpful" validate:"min=0"` | ||
|
||
AskedByID uint `gorm:"type:uuid" json:"-" validate:"min=1"` | ||
AskedBy User `gorm:"foreignKey:AskedByID" json:"-" validate:"-"` | ||
AskedByID uuid.UUID `gorm:"type:uuid" json:"-" validate:"uuid4"` | ||
AskedBy User `gorm:"foreignKey:AskedByID" json:"-" validate:"-"` | ||
|
||
ClubID uint `gorm:"type:uuid" json:"-" validate:"min=1"` | ||
Club Club `gorm:"foreignKey:ClubID" json:"-" validate:"-"` | ||
ClubID uuid.UUID `gorm:"type:uuid" json:"-" validate:"uuid4"` | ||
Club Club `gorm:"foreignKey:ClubID" json:"-" validate:"-"` | ||
|
||
AnsweredByID *uint `gorm:"type:uuid" json:"-" validate:"min=1"` | ||
AnsweredBy *User `gorm:"foreignKey:AnsweredBy" json:"-" validate:"-"` | ||
AnsweredByID *uuid.UUID `gorm:"type:uuid" json:"-" validate:"uuid4"` | ||
AnsweredBy *User `gorm:"foreignKey:AnsweredBy" json:"-" validate:"-"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
package models | ||
|
||
import ( | ||
"github.com/GenerateNU/sac/backend/src/types" | ||
) | ||
import "github.com/google/uuid" | ||
|
||
type PointOfContact struct { | ||
types.Model | ||
Model | ||
|
||
Name string `gorm:"type:varchar(255)" json:"name" validate:"required,max=255"` | ||
Email string `gorm:"type:varchar(255)" json:"email" validate:"required,email,max=255"` | ||
Photo string `gorm:"type:varchar(255);default:NULL" json:"photo" validate:"url,max=255"` // S3 URL, fallback to default logo if null | ||
Position string `gorm:"type:varchar(255);" json:"position" validate:"required,max=255"` | ||
|
||
ClubID uint `gorm:"foreignKey:ClubID" json:"-" validate:"min=1"` | ||
ClubID uuid.UUID `gorm:"foreignKey:ClubID" json:"-" validate:"uuid4"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
package types | ||
package models | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/google/uuid" | ||
) | ||
|
||
type Model struct { | ||
ID uint `gorm:"primarykey" json:"id" example:"1"` | ||
ID uuid.UUID `gorm:"type:uuid;primary_key;default:uuid_generate_v4()" json:"id" example:"123e4567-e89b-12d3-a456-426614174000"` | ||
CreatedAt time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP" json:"created_at" example:"2023-09-20T16:34:50Z"` | ||
UpdatedAt time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP" json:"updated_at" example:"2023-09-20T16:34:50Z"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,20 @@ | ||
package models | ||
|
||
import ( | ||
"github.com/GenerateNU/sac/backend/src/types" | ||
) | ||
import "github.com/google/uuid" | ||
|
||
type Tag struct { | ||
types.Model | ||
Model | ||
|
||
Name string `gorm:"type:varchar(255)" json:"name" validate:"required,max=255"` | ||
|
||
CategoryID uint `gorm:"foreignKey:CategoryID" json:"category_id" validate:"required,min=1"` | ||
CategoryID uuid.UUID `gorm:"foreignKey:CategoryID" json:"category_id" validate:"required,uuid4"` | ||
|
||
User []User `gorm:"many2many:user_tags;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-" validate:"-"` | ||
Club []Club `gorm:"many2many:club_tags;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-" validate:"-"` | ||
Event []Event `gorm:"many2many:event_tags;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-" validate:"-"` | ||
} | ||
|
||
type TagRequestBody struct { | ||
Name string `json:"name" validate:"required,max=255"` | ||
CategoryID uint `json:"category_id" validate:"required,min=1"` | ||
} | ||
Name string `json:"name" validate:"required,max=255"` | ||
CategoryID uuid.UUID `json:"category_id" validate:"required,uuid4"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.