96 lines
4.5 KiB
Go
96 lines
4.5 KiB
Go
package asset
|
|
|
|
import (
|
|
"encoding/json"
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type CategoryModel struct {
|
|
ID uuid.UUID `gorm:"type:uuid;primaryKey;default:gen_random_uuid()"`
|
|
Name string `gorm:"column:name;type:text;not null"`
|
|
Icon string `gorm:"column:icon;type:text"`
|
|
Color string `gorm:"column:color;type:text"`
|
|
CardType string `gorm:"column:card_type;type:text"`
|
|
Featured bool `gorm:"column:featured;type:boolean;default:false"`
|
|
Description string `gorm:"column:description;type:text"`
|
|
CreatedAt time.Time `gorm:"column:created_at;type:timestamptz;not null"`
|
|
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamptz;not null"`
|
|
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:timestamptz;index"`
|
|
}
|
|
|
|
func (CategoryModel) TableName() string {
|
|
return "asset_categories"
|
|
}
|
|
|
|
type Model struct {
|
|
ID uuid.UUID `gorm:"type:uuid;primaryKey;default:gen_random_uuid()"`
|
|
ProfileID uuid.UUID `gorm:"column:profile_id;type:uuid;not null;index:assets_profile_id_idx"`
|
|
Status int `gorm:"column:status;type:integer;not null;default:0"`
|
|
AssetCategoryID uuid.UUID `gorm:"column:asset_category_id;type:uuid;not null;index:assets_category_id_idx"`
|
|
Title string `gorm:"column:title;type:text;not null"`
|
|
Description string `gorm:"column:description;type:text"`
|
|
Link string `gorm:"column:link;type:text"`
|
|
Analytics json.RawMessage `gorm:"column:analytics;type:jsonb"`
|
|
CreatedAt time.Time `gorm:"column:created_at;type:timestamptz;not null"`
|
|
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamptz;not null"`
|
|
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:timestamptz;index"`
|
|
}
|
|
|
|
func (Model) TableName() string {
|
|
return "assets"
|
|
}
|
|
|
|
type ArtifactModel struct {
|
|
ID uuid.UUID `gorm:"type:uuid;primaryKey;default:gen_random_uuid()"`
|
|
AssetID uuid.UUID `gorm:"column:asset_id;type:uuid;not null;index:asset_artifacts_asset_id_idx"`
|
|
Type string `gorm:"column:type;type:text;not null"`
|
|
DownloadURL string `gorm:"column:download_url;type:text"`
|
|
Price int `gorm:"column:price;type:integer;default:0"`
|
|
Title string `gorm:"column:title;type:text"`
|
|
Description string `gorm:"column:description;type:text"`
|
|
CreatedAt time.Time `gorm:"column:created_at;type:timestamptz;not null"`
|
|
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamptz;not null"`
|
|
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:timestamptz;index"`
|
|
}
|
|
|
|
func (ArtifactModel) TableName() string {
|
|
return "asset_artifacts"
|
|
}
|
|
|
|
type CommentModel struct {
|
|
ID uuid.UUID `gorm:"type:uuid;primaryKey;default:gen_random_uuid()"`
|
|
AssetID uuid.UUID `gorm:"column:asset_id;type:uuid;not null;index:asset_comments_asset_id_idx"`
|
|
Content string `gorm:"column:content;type:text;not null"`
|
|
WriterID uuid.UUID `gorm:"column:writer_id;type:uuid;not null"`
|
|
WriterType string `gorm:"column:writer_type;type:text;not null"`
|
|
ParentID *uuid.UUID `gorm:"column:parent_id;type:uuid;index:asset_comments_parent_id_idx"`
|
|
CreatedAt time.Time `gorm:"column:created_at;type:timestamptz;not null"`
|
|
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamptz;not null"`
|
|
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:timestamptz;index"`
|
|
}
|
|
|
|
func (CommentModel) TableName() string {
|
|
return "asset_comments"
|
|
}
|
|
|
|
type ReportModel struct {
|
|
ID uuid.UUID `gorm:"type:uuid;primaryKey;default:gen_random_uuid()"`
|
|
AssetID uuid.UUID `gorm:"column:asset_id;type:uuid;not null;index:asset_reports_asset_id_idx"`
|
|
ReportedBy json.RawMessage `gorm:"column:reported_by;type:jsonb;not null"`
|
|
ReportedAt time.Time `gorm:"column:reported_at;type:timestamptz;not null"`
|
|
Reason json.RawMessage `gorm:"column:reason;type:jsonb;not null"`
|
|
Status int `gorm:"column:status;type:integer;not null;default:0"`
|
|
Notes string `gorm:"column:notes;type:text"`
|
|
Attachments json.RawMessage `gorm:"column:attachments;type:jsonb"`
|
|
CreatedAt time.Time `gorm:"column:created_at;type:timestamptz;not null"`
|
|
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamptz;not null"`
|
|
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:timestamptz;index"`
|
|
}
|
|
|
|
func (ReportModel) TableName() string {
|
|
return "asset_reports"
|
|
}
|