model

package
v0.0.0-...-381d51a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(db *gorm.DB) error

Types

type Attachment

type Attachment struct {
	Model

	ChallengeId uint32
	Name        string
	URL         string
}

type Challenge

type Challenge struct {
	Model `json:"model"`

	Name        string  `gorm:"unique" json:"name"`
	Flag        string  `gorm:"unique" json:"flag"`
	Description string  `gorm:"size:10000" json:"description"`
	Category    string  `json:"category"`
	Author      string  `json:"author"`
	Host        *string `json:"host"`
	Port        *int    `json:"port"`

	IsOpen    bool `json:"is_open"`
	IsRunning bool `json:"is_running"`
	IsSurvey  bool `json:"is_survey"`
}

type Config

type Config struct {
	Model

	Token string

	CTFName string
	StartAt int64
	EndAt   int64

	RegisterOpen bool
	CTFOpen      bool

	LockCount    int64
	LockSecond   int
	LockDuration int

	ScoreExpr string `gorm:"size:10000"`
}

type ErrorMessage

type ErrorMessage string

func (ErrorMessage) Error

func (msg ErrorMessage) Error() string

type LoginToken

type LoginToken struct {
	Model

	TeamId    uint32
	Token     string `gorm:"unique"`
	IPAddress string
	ExpiresAt int64
}

type Message

type Message struct {
	Model

	Key   string `gorm:"unique"`
	Value string
}

type Model

type Model struct {
	ID        uint32         `gorm:"primaryKey" json:"id"`
	CreatedAt int64          `gorm:"autoCreateTime" json:"-"`
	UpdatedAt int64          `gorm:"autoUpdateTime" json:"-"`
	DeletedAt gorm.DeletedAt `json:"-"`
}

func (*Model) BeforeCreate

func (model *Model) BeforeCreate(tx *gorm.DB) error

type PasswordResetToken

type PasswordResetToken struct {
	Model

	TeamId    uint32
	Token     string `gorm:"unique"`
	ExpiresAt int64
}

type Submission

type Submission struct {
	Model

	ChallengeId *uint32
	TeamId      uint32
	IsCorrect   bool
	IsValid     bool
	Flag        string
	IPAddress   string
	SubmittedAt int64
}

type SubmissionLock

type SubmissionLock struct {
	Model

	TeamId uint32
	Until  int64
}

type Tag

type Tag struct {
	Model

	ChallengeId uint32
	Tag         string
}

type Team

type Team struct {
	Model

	Teamname     string `gorm:"unique"`
	Email        string `gorm:"unique"`
	PasswordHash string
	CountryCode  string

	IsAdmin bool
}

type ValidSubmission

type ValidSubmission struct {
	Model

	ChallengeId  uint32 `gorm:"unique_index:valid_submission"`
	TeamId       uint32 `gorm:"unique_index:valid_submission"`
	SubmissionId uint32
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL