24 lines
813 B
Go
24 lines
813 B
Go
package models
|
|
|
|
import "time"
|
|
|
|
type Author struct {
|
|
ID uint32 `gorm:"primaryKey;autoIncrement"`
|
|
Name string `gorm:"size:100;not null"`
|
|
Slug string `gorm:"size:100;not null;uniqueIndex"`
|
|
Bio string `gorm:"size:280;not null"`
|
|
AvatarID *uint32 `gorm:"index"`
|
|
Website *string `gorm:"size:2048"`
|
|
SocialLinks string `gorm:"type:text;not null"`
|
|
UserID *uint32 `gorm:"uniqueIndex"`
|
|
CreatedAt time.Time `gorm:"autoCreateTime"`
|
|
UpdatedAt time.Time `gorm:"autoUpdateTime"`
|
|
}
|
|
|
|
type ArticleAuthor struct {
|
|
ID uint32 `gorm:"primaryKey;autoIncrement"`
|
|
ArticleID uint32 `gorm:"not null;uniqueIndex:idx_article_authors_pair"`
|
|
AuthorID uint32 `gorm:"not null;uniqueIndex:idx_article_authors_pair;index"`
|
|
Position int `gorm:"not null"`
|
|
}
|