models

package
v0.0.0-...-74e7022 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Answer

type Answer struct {
	bun.BaseModel `bun:",alias:a"`

	ID         int32  `bun:",pk,autoincrement"`
	QuestionID int32  `bun:",notnull"`
	Title      string `bun:",notnull,type:varchar(255)"`
	Points     int8   `bun:",notnull"`
}

func (*Answer) BeforeCreateTable

func (*Answer) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

type Application

type Application struct {
	bun.BaseModel `bun:",alias:ap"`

	EventID   int32 `bun:",pk"`
	StudentID int32 `bun:",pk"`
	Score     int16 `bun:",notnull"`
	Accepted  *bool `bun:",default:false"`

	Event   *Event `bun:"rel:belongs-to,join:event_id=id"`
	Student *User  `bun:"rel:belongs-to,join:student_id=id"`
	Form    *Form  `bun:"rel:belongs-to,join:event_id=event_id"`
}

func (*Application) BeforeCreateTable

func (*Application) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

type ApplicationToQuestion

type ApplicationToQuestion struct {
	bun.BaseModel `bun:",alias:aq"`

	ID          int32 `bun:",pk,autoincrement"`
	EventID     int32
	StudentID   int32
	Application *Application `bun:"rel:belongs-to,join:event_id=event_id,join:student_id=student_id"`
	QuestionID  int32
	Question    *Question `bun:"rel:belongs-to,join:question_id=id"`

	AnswerID int32
	Answer   *Answer `bun:"rel:belongs-to,join:answer_id=id"`
	Value    string
}

func (*ApplicationToQuestion) BeforeCreateTable

func (*ApplicationToQuestion) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

type Building

type Building struct {
	bun.BaseModel `bun:",alias:b"`

	ID        int32   `bun:",pk,autoincrement"`
	Name      string  `bun:",type:varchar(255)"`
	Street    string  `bun:",notnull,type:varchar(255)"`
	Number    string  `bun:",notnull,type:varchar(255)"`
	City      string  `bun:",notnull,type:varchar(255)"`
	Zip       string  `bun:",notnull,type:varchar(10)"`
	Latitude  float64 `bun:",notnull"`
	Longitude float64 `bun:",notnull"`
	ZoomLevel int     `bun:",notnull"`

	Rooms []*Room `bun:"rel:has-many,join:id=building_id"`
}

type ConfirmationToken

type ConfirmationToken struct {
	bun.BaseModel `bun:",alias:ct"`

	UserID    int32
	Token     string    `bun:",pk,type:varchar(43)"`
	ExpiresAt time.Time `bun:",nullzero,notnull"`
}

func (*ConfirmationToken) BeforeCreateTable

func (*ConfirmationToken) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

type Event

type Event struct {
	bun.BaseModel `bun:",alias:e"`

	ID                 int32  `bun:",pk,autoincrement"`
	Title              string `bun:",notnull,type:varchar(255)"`
	Description        string
	TypeID             int32
	From               time.Time `bun:",notnull"`
	To                 time.Time `bun:",notnull"`
	NeedsTutors        *bool
	UmbrellaID         *int32
	TutorialsOpen      *bool `bun:",notnull,default:false"`
	RegistrationNeeded *bool `bun:",notnull,default:true"`

	Umbrella         *Event      `bun:"rel:belongs-to,join:umbrella_id=id"`
	Topics           []*Label    `bun:"m2m:topic_to_events,join:Event=Topic"`
	Type             *Label      `bun:"rel:belongs-to,join:type_id=id"`
	Tutorials        []*Tutorial `bun:"rel:has-many,join:id=event_id"`
	TutorsAvailable  []*User     `bun:"m2m:user_to_event_availabilities,join:Event=User"`
	RegistrationForm *Form       `bun:"rel:has-one,join:id=event_id"`
	SupportingEvents []Event     `bun:"m2m:event_to_supporting_events,join:Event=SupportingEvent"`
}

func (*Event) BeforeCreateTable

func (*Event) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

type EventToSupportingEvent

type EventToSupportingEvent struct {
	bun.BaseModel `bun:"table:event_to_supporting_events,alias:ese"`

	EventID           int32  `bun:",pk"`
	Event             *Event `bun:"rel:belongs-to,join:event_id=id"`
	SupportingEventID int32  `bun:",pk"`
	SupportingEvent   *Event `bun:"rel:belongs-to,join:supporting_event_id=id"`
}

func (*EventToSupportingEvent) BeforeCreateTable

func (*EventToSupportingEvent) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

type Form

type Form struct {
	bun.BaseModel `bun:",alias:f"`

	EventID     int32  `bun:",pk"`
	Title       string `bun:",notnull,type:varchar(255)"`
	Description string

	Questions []*Question `bun:"rel:has-many,join:event_id=form_id"`
}

func (*Form) BeforeCreateTable

func (*Form) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

type Label

type Label struct {
	bun.BaseModel `bun:",alias:l"`

	ID    int32  `bun:",pk,autoincrement"`
	Name  string `bun:",type:varchar(50),unique"`
	Color string `bun:",type:varchar(7)"`
	Kind  string `bun:",notnull,type:varchar(20)"`
}

type Question

type Question struct {
	bun.BaseModel `bun:",alias:q"`

	ID       int32  `bun:",pk,autoincrement"`
	Title    string `bun:",notnull,type:varchar(255)"`
	Type     string `bun:",notnull,type:varchar(50)"`
	Required bool
	FormID   int32

	Answers []*Answer `bun:"rel:has-many,join:id=question_id"`
	Form    *Form     `bun:"rel:belongs-to,join:form_id=event_id"`
}

type Room

type Room struct {
	bun.BaseModel `bun:",alias:r"`

	Number     string `bun:",pk,notnull,type:varchar(50)"`
	BuildingID int32  `bun:",pk"`
	Name       string `bun:",type:varchar(255)"`
	Capacity   int16
	Floor      int8

	Building *Building `bun:"rel:belongs-to,join:building_id=id"`
}

func (*Room) BeforeCreateTable

func (*Room) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

type Setting

type Setting struct {
	bun.BaseModel `bun:",alias:s"`

	Key   string `bun:",pk,type:varchar(255)"`
	Value string `bun:",notnull"`
	Type  string `bun:",notnull,type:varchar(50)"`
}

type TopicToEvent

type TopicToEvent struct {
	bun.BaseModel `bun:"table:topic_to_events,alias:tte"`

	EventID int32  `bun:",pk"`
	Event   *Event `bun:"rel:belongs-to,join:event_id=id"`
	TopicID int32  `bun:",pk"`
	Topic   *Label `bun:"rel:belongs-to,join:topic_id=id"`
}

func (*TopicToEvent) BeforeCreateTable

func (*TopicToEvent) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

type Tutorial

type Tutorial struct {
	bun.BaseModel `bun:",alias:t"`

	ID          int32  `bun:",pk,autoincrement"`
	EventID     int32  `bun:",notnull"`
	RoomNumber  string `bun:",notnull"`
	BuildingID  int32  `bun:",notnull"`
	Capacity    int16  `bun:",default:0"`
	Description string

	Event  *Event `bun:"rel:belongs-to,join:event_id=id"`
	Room   *Room  `bun:"rel:belongs-to,join:room_number=number,join:building_id=building_id"`
	Tutors []User `bun:"m2m:tutorial_to_user_assignments,join:Tutorial=User"`
}

func (*Tutorial) BeforeCreateTable

func (*Tutorial) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

type TutorialToUserAssignment

type TutorialToUserAssignment struct {
	bun.BaseModel `bun:"table:tutorial_to_user_assignments,alias:tua"`

	UserID     int32     `bun:",pk"`
	User       *User     `bun:"rel:belongs-to,join:user_id=id"`
	TutorialID int32     `bun:",pk"`
	Tutorial   *Tutorial `bun:"rel:belongs-to,join:tutorial_id=id"`
}

func (*TutorialToUserAssignment) BeforeCreateTable

func (*TutorialToUserAssignment) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

type User

type User struct {
	bun.BaseModel `bun:",alias:u"`

	ID        int32     `bun:",pk,autoincrement"`
	Mail      string    `bun:"type:varchar(255),unique"`
	Fn        string    `bun:"type:varchar(255),notnull"`
	Sn        string    `bun:"type:varchar(255),notnull"`
	Confirmed *bool     `bun:",notnull,default:false"`
	SessionID string    `bun:"type:varchar(15)"`
	LastLogin time.Time `bun:",nullzero,notnull,default:current_timestamp"`
	Password  string    `bun:"type:varchar(64)"`
	CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp"`
	Role      string    `bun:"type:varchar(5),nullzero,notnull,default:'USER'"`

	Availabilities []Event        `bun:"m2m:user_to_event_availabilities,join:User=Event"`
	Tutorials      []Tutorial     `bun:"m2m:tutorial_to_user_assignments,join:User=Tutorial"`
	Registrations  []Tutorial     `bun:"m2m:user_to_tutorial_registrations,join:User=Tutorial"`
	Applications   []*Application `bun:"rel:has-many,join:id=student_id"`
}

type UserToEventAvailability

type UserToEventAvailability struct {
	bun.BaseModel `bun:"table:user_to_event_availabilities,alias:uea"`

	UserID  int32  `bun:",pk"`
	User    *User  `bun:"rel:belongs-to,join:user_id=id"`
	EventID int32  `bun:",pk"`
	Event   *Event `bun:"rel:belongs-to,join:event_id=id"`
}

func (*UserToEventAvailability) BeforeCreateTable

func (*UserToEventAvailability) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

type UserToTutorialRegistration

type UserToTutorialRegistration struct {
	bun.BaseModel `bun:"table:user_to_tutorial_registrations,alias:utr"`

	UserID     int32     `bun:",pk"`
	User       *User     `bun:"rel:belongs-to,join:user_id=id"`
	TutorialID int32     `bun:",pk"`
	Tutorial   *Tutorial `bun:"rel:belongs-to,join:tutorial_id=id"`
}

func (*UserToTutorialRegistration) BeforeCreateTable

func (*UserToTutorialRegistration) BeforeCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

Jump to

Keyboard shortcuts

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