refactor: project name and set default plan for new user
This commit is contained in:
@@ -2,13 +2,11 @@ package database
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type News struct {
|
||||
ID uuid.UUID `gorm:"type:uuid;primaryKey" json:"id"`
|
||||
AuthorID uuid.UUID `gorm:"type:uuid;not null" json:"author_id"`
|
||||
ID string `gorm:"primaryKey" json:"id"`
|
||||
AuthorID string `gorm:"not null" json:"author_id"`
|
||||
Title string `gorm:"default:null" json:"title"`
|
||||
Content string `gorm:"default:null" json:"content"`
|
||||
IsPremium bool `gorm:"default:false" json:"is_premium"`
|
||||
|
||||
@@ -2,12 +2,10 @@ package database
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type Staff struct {
|
||||
ID uuid.UUID `gorm:"type:uuid;primaryKey" json:"id"`
|
||||
ID string `gorm:"primaryKey" json:"id"`
|
||||
Username string `gorm:"default:null" json:"username"`
|
||||
Email string `gorm:"unique,not null" json:"email"`
|
||||
Password string `gorm:"not null" json:"password"`
|
||||
|
||||
@@ -2,13 +2,11 @@ package database
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type Subscribe struct {
|
||||
ID uuid.UUID `gorm:"type:uuid;primaryKey" json:"id"`
|
||||
SubscribePlanID uuid.UUID `gorm:"type:uuid;not null" json:"subscribe_plan_id"`
|
||||
ID string `gorm:"primaryKey" json:"id"`
|
||||
SubscribePlanID string `gorm:"not null" json:"subscribe_plan_id"`
|
||||
StartDate time.Time `gorm:"default:CURRENT_TIMESTAMP"`
|
||||
EndDate time.Time `gorm:"default:null"`
|
||||
Status string `gorm:"default:'inactive'"`
|
||||
@@ -20,7 +18,7 @@ type Subscribe struct {
|
||||
}
|
||||
|
||||
type SubscribePlan struct {
|
||||
ID uuid.UUID `gorm:"type:uuid;primaryKey" json:"id"`
|
||||
ID string `gorm:"primaryKey" json:"id"`
|
||||
Code string `gorm:"not null" json:"code"`
|
||||
Name string `gorm:"not null" json:"name"`
|
||||
CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP"`
|
||||
|
||||
@@ -2,12 +2,10 @@ package database
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type Tags struct {
|
||||
ID uuid.UUID `gorm:"type:uuid;primaryKey;not null" json:"id"`
|
||||
ID string `gorm:"primaryKey;not null" json:"id"`
|
||||
Code string `gorm:"not null" json:"code"`
|
||||
Name string `gorm:"not null" json:"name"`
|
||||
CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"`
|
||||
|
||||
@@ -2,17 +2,16 @@ package database
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type User struct {
|
||||
ID uuid.UUID `gorm:"type:uuid;primaryKey" json:"id"`
|
||||
ID string `gorm:"primaryKey" json:"id"`
|
||||
SubscribeID string `gorm:"not null" json:"subscribe_id"`
|
||||
Email string `gorm:"unique,not null" json:"email"`
|
||||
Password string `gorm:"not null" json:"password"`
|
||||
Phone string `gorm:"default:null" json:"phone"`
|
||||
Subscribe Subscribe `gorm:"foreignKey:SubscribeID;constraint:OnDelete:CASCADE"`
|
||||
CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"`
|
||||
|
||||
Subscribe Subscribe `gorm:"foreignKey:SubscribeID;constraint:OnDelete:CASCADE"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user