2022-09-20 16:42:57 +08:00
|
|
|
package model
|
|
|
|
|
2022-10-04 15:31:07 +08:00
|
|
|
import (
|
2022-10-22 17:38:39 +08:00
|
|
|
"github.com/jackc/pgtype"
|
2022-10-04 15:31:07 +08:00
|
|
|
"gorm.io/gorm"
|
|
|
|
)
|
2022-09-20 16:42:57 +08:00
|
|
|
|
|
|
|
type Problem struct {
|
2022-10-22 17:38:39 +08:00
|
|
|
gorm.Model `json:"meta"`
|
2023-12-27 21:30:52 +08:00
|
|
|
Title string `json:"title" gorm:"not null;index"`
|
|
|
|
Statement string `json:"statement" gorm:"not null"`
|
|
|
|
Tags pgtype.TextArray `json:"tags" gorm:"type:text[];index"`
|
|
|
|
ProviderID uint `json:"-" gorm:"not null;index"`
|
|
|
|
Provider User `json:"provider" gorm:"foreignKey:ProviderID"`
|
|
|
|
IsEnabled bool `json:"is_enabled" gorm:"not null;index"`
|
2022-10-22 17:38:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
type ProblemVersion struct {
|
|
|
|
gorm.Model `json:"meta"`
|
|
|
|
ProblemID uint `json:"-" gorm:"not null;index"`
|
2024-04-28 23:19:00 +08:00
|
|
|
Problem Problem `json:"problem" gorm:"foreignKey:ProblemID"`
|
2022-10-22 17:38:39 +08:00
|
|
|
Context pgtype.JSON `json:"context" gorm:"type:json"`
|
|
|
|
StorageKey string `json:"-" gorm:"not null"`
|
|
|
|
IsEnabled bool `json:"is_enabled" gorm:"not null;index"`
|
2022-09-20 16:42:57 +08:00
|
|
|
}
|