models

package
v0.0.0-...-7e18203 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 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"`
	StudentMail string `bun:",notnull,type:varchar(255)"`
	Score       int16  `bun:",notnull,default:0"`
	Accepted    *bool

	Event   *Event `bun:"rel:belongs-to,join:event_id=id"`
	Student *User  `bun:"rel:belongs-to,join:student_mail=mail"`
	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
	StudentMail string
	Application *Application `bun:"rel:belongs-to,join:event_id=event_id,join:student_mail=student_mail"`
	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       int32   `bun:",notnull"`
	Latitude  float64 `bun:",notnull,type:decimal(9,6)"`
	Longitude float64 `bun:",notnull,type:decimal(9,6)"`
	ZoomLevel int8    `bun:"default:15"`

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

type Event

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

	ID          int32  `bun:",pk,autoincrement"`
	Title       string `bun:",notnull,type:varchar(255)"`
	Description string
	TopicName   string    `bun:",type:varchar(50)"`
	TypeName    string    `bun:",type:varchar(50)"`
	From        time.Time `bun:",notnull"`
	To          time.Time `bun:",notnull"`
	NeedsTutors bool      `bun:",notnull"`
	UmbrellaID  *int32

	Umbrella         *Event `bun:"rel:belongs-to,join:umbrella_id=id"`
	Topic            *Label `bun:"rel:belongs-to,join:topic_name=name"`
	Type             *Label `bun:"rel:belongs-to,join:type_name=name"`
	TutorsAssigned   []User `bun:"m2m:event_to_user_assignments,join:Event=User"`
	TutorsAvailable  []User `bun:"m2m:user_to_event_availabilitys,join:Event=User"`
	RoomsAvailable   []Room `bun:"m2m:room_to_event_availabilitys,join:Event=Room"`
	RegistrationForm *Form  `bun:"rel:has-one,join:id=event_id"`
}

func (*Event) BeforeCreateTable

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

type EventToUserAssignment

type EventToUserAssignment struct {
	bun.BaseModel `bun:"table:event_to_user_assignments,alias:eta"`

	EventID    int32     `bun:",pk"`
	Event      *Event    `bun:"rel:belongs-to,join:event_id=id"`
	UserMail   string    `bun:",pk"`
	User       *User     `bun:"rel:belongs-to,join:user_mail=mail"`
	RoomNumber string    `bun:",pk,type:varchar(50)"`
	BuildingID int32     `bun:",pk"`
	Building   *Building `bun:"rel:belongs-to,join:building_id=id"`
	Room       *Room     `bun:"rel:belongs-to,join:room_number=number,join:building_id=building_id"`
}

func (*EventToUserAssignment) BeforeCreateTable

func (*EventToUserAssignment) 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"`

	Name  string `bun:",pk,type:varchar(50)"`
	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 RoomToEventAvailability

type RoomToEventAvailability struct {
	bun.BaseModel `bun:"table:room_to_event_availabilitys,alias:rea"`

	RoomNumber string `bun:",pk,type:varchar(50)"`
	BuildingID int32  `bun:",pk"`
	Room       *Room  `bun:"rel:belongs-to,join:room_number=number,join:building_id=building_id"`
	EventID    int32  `bun:",pk"`
	Event      *Event `bun:"rel:belongs-to,join:event_id=id"`
}

func (*RoomToEventAvailability) BeforeCreateTable

func (*RoomToEventAvailability) 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 User

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

	Mail      string    `bun:",pk,notnull,type:varchar(255)"`
	Fn        string    `bun:",notnull,type:varchar(255)"`
	Sn        string    `bun:"type:varchar(255)"`
	Confirmed bool      `bun:"confirmed,notnull"`
	SessionID string    `bun:"type:varchar(11)"`
	LastLogin time.Time `bun:",default:current_timestamp"`
	Password  string    `bun:"type:varchar(64)"`
	Salt      string    `bun:"type:varchar(22)"`
	CreatedAt time.Time `bun:",default:current_timestamp"`

	EventsAvailable  []Event        `bun:"m2m:user_to_event_availabilitys,join:User=Event"`
	EventsAssigned   []Event        `bun:"m2m:event_to_user_assignments,join:User=Event"`
	EventsRegistered []Event        `bun:"m2m:user_to_event_registrations,join:User=Event"`
	Applications     []*Application `bun:"rel:has-many,join:mail=student_mail"`
}

type UserToEventAvailability

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

	UserMail string `bun:",pk,type:varchar(255)"`
	User     *User  `bun:"rel:belongs-to,join:user_mail=mail"`
	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 UserToEventRegistration

type UserToEventRegistration struct {
	bun.BaseModel `bun:"table:user_to_event_registrations,alias:ser"`

	UserMail   string `bun:",pk,type:varchar(255)"`
	User       *User  `bun:"rel:belongs-to,join:user_mail=mail"`
	EventID    int32  `bun:",pk"`
	Event      *Event `bun:"rel:belongs-to,join:event_id=id"`
	RoomNumber string `bun:",pk,type:varchar(50)"`
	BuildingID int32  `bun:",pk"`
	Room       *Room  `bun:"rel:belongs-to,join:room_number=number,join:building_id=building_id"`
}

func (*UserToEventRegistration) BeforeCreateTable

func (*UserToEventRegistration) 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