model

package
v0.0.0-...-2ab3aae Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *sql.DB

Functions

func ChangeAccountPassword

func ChangeAccountPassword(username string, oldPassword string, newPassword string) (bool, error)

func ConnectDatabase

func ConnectDatabase(dbPath string) error

func CreateBuilding

func CreateBuilding(p ProposedBuilding, id int) (bool, error)

func CreateFloor

func CreateFloor(f ProposedFloor, id int) (bool, error)

func CreateLocation

func CreateLocation(p ProposedLocation, id int) (bool, error)

func CreatePanel

func CreatePanel(p ProposedPanel, id int) (bool, error)

func CreateUser

func CreateUser(p ProposedUser) (bool, error)

func DeleteBuildingById

func DeleteBuildingById(id int) (bool, error)

func DeleteFloorById

func DeleteFloorById(id int) (bool, error)

func DeleteLocationById

func DeleteLocationById(id int) (bool, error)

func DeletePanelById

func DeletePanelById(id int) (bool, error)

func DeleteUser

func DeleteUser(username string) (bool, error)

func GetBuildingIdByName

func GetBuildingIdByName(buildingName string) (int, error)

func GetUserStatus

func GetUserStatus(username string) (string, error)

func SetApprovalStatusPanelById

func SetApprovalStatusPanelById(id int, status PanelApproval, userId int) (bool, error)

func SetPanelAgeRestrictionById

func SetPanelAgeRestrictionById(id int, status PanelAgeRestrictionState) (bool, error)

func SetPanelLocation

func SetPanelLocation(id int, j Location) (bool, error)

func SetPanelScheduledTimeById

func SetPanelScheduledTimeById(id int, json PanelScheduledTime) (bool, string, error)

func SetUserStatus

func SetUserStatus(username string, j UserStatus) (bool, error)

func UpdateBuildingById

func UpdateBuildingById(id int, b BuildingUpdate) (bool, error)

func UpdateFloorById

func UpdateFloorById(id int, f FloorUpdate) (bool, error)

func UpdateLocationById

func UpdateLocationById(id int, l LocationUpdate) (bool, error)

Types

type Building

type Building struct {
	Id           int    `json:"Id"`
	Name         string `json:"name"`
	City         string `json:"city"`
	Region       string `json:"region"`
	CreatorId    int    `json:"creatorId"`
	CreationDate string `json:"creationDateTime"`
}

func GetBuildingById

func GetBuildingById(id int) (Building, error)

func GetBuildings

func GetBuildings() ([]Building, error)

type BuildingFloor

type BuildingFloor struct {
	Id           int    `json:"Id"`
	FloorName    string `json:"floorName"`
	BuildingId   int    `json:"buildingId"`
	CreatorId    int    `json:"creatorId"`
	CreationDate string `json:"creationDateTime"`
}

func GetAllFloors

func GetAllFloors() ([]BuildingFloor, error)

func GetFloorById

func GetFloorById(id int) (BuildingFloor, error)

func GetFloorsByBuildingId

func GetFloorsByBuildingId(id int) ([]BuildingFloor, error)

type BuildingList

type BuildingList struct {
	Data []Building `json:"data"`
}

type BuildingUpdate

type BuildingUpdate struct {
	Name   string `json:"name"`
	City   string `json:"city"`
	Region string `json:"region"`
}

type FailureMsg

type FailureMsg struct {
	Error string `json:"error"`
}

type FloorList

type FloorList struct {
	Data []BuildingFloor `json:"data"`
}

type FloorUpdate

type FloorUpdate struct {
	FloorName  string `json:"name"`
	BuildingId int    `json:"buildingId"`
}

type HealthCheck

type HealthCheck struct {
	Db           string `json:"db"`
	DiskSpace    string `json:"diskSpace"`
	DiskWritable string `json:"diskWritable"`
	Health       string `json:"health"`
	Status       int    `json:"status"`
}

type InvalidStatusValue

type InvalidStatusValue struct {
	Err error
}

func (*InvalidStatusValue) Error

func (i *InvalidStatusValue) Error() string

type Location

type Location struct {
	Id           int    `json:"Id"`
	Location     string `json:"location"`
	FloorId      int    `json:"floorId"`
	BuildingId   int    `json:"buildingId"`
	CreatorId    int    `json:"creatorId"`
	CreationDate string `json:"creationDateTime"`
}

func GetAllLocations

func GetAllLocations() ([]Location, error)

func GetLocationById

func GetLocationById(id int) (Location, error)

func GetLocationsByBuildingId

func GetLocationsByBuildingId(id int) ([]Location, error)

func GetLocationsByFloorId

func GetLocationsByFloorId(id int) ([]Location, error)

func GetPanelLocationByPanelId

func GetPanelLocationByPanelId(id int) (Location, error)

type LocationList

type LocationList struct {
	Data []Location `json:"data"`
}

type LocationUpdate

type LocationUpdate struct {
	FloorId    int `json:"floorId"`
	BuildingId int `json:"buildingId"`
}

type Panel

type Panel struct {
	Id                  int    `json:"Id"`
	Topic               string `json:"topic"`
	Description         string `json:"description"`
	PanelRequestorEmail string `json:"panelRequestorEmail"`
	Location            string `json:"location"`
	ScheduledTime       string `json:"scheduledTime"`
	DurationInMinutes   int    `json:"durationInMinutes"`
	AgeRestricted       bool   `json:"ageRestricted"`
	CreatorId           int    `json:"creatorId"`
	CreationDateTime    string `json:"creationDateTime"`
	ApprovalStatus      bool   `json:"approvalStatus"`
	ApprovedById        int    `json:"approvedById"`
	ApprovalDateTime    string `json:"approvalDateTime"`
}

func GetPanelById

func GetPanelById(id int) (Panel, error)

type PanelAgeRestrictionState

type PanelAgeRestrictionState struct {
	RestrictionState bool `json:"restrictionState"`
}

type PanelApproval

type PanelApproval struct {
	State bool `json:"state"`
}

type PanelList

type PanelList struct {
	Data []Panel `json:"data"`
}

type PanelSQL

type PanelSQL struct {
	Id                  int            `json:"Id"`
	Topic               string         `json:"topic"`
	Description         string         `json:"description"`
	PanelRequestorEmail string         `json:"panelRequestorEmail"`
	Location            string         `json:"location"`
	ScheduledTime       sql.NullString `json:"scheduledTime"`
	DurationInMinutes   int            `json:"durationInMinutes"`
	AgeRestricted       bool           `json:"ageRestricted"`
	CreatorId           int            `json:"creatorId"`
	CreationDateTime    string         `json:"creationDateTime"`
	ApprovalStatus      bool           `json:"approvalStatus"`
	ApprovedById        sql.NullInt64  `json:"approvedById"`
	ApprovalDateTime    sql.NullString `json:"approvalDateTime"`
}

func GetPanels

func GetPanels() ([]PanelSQL, error)

func GetPanelsByLocationId

func GetPanelsByLocationId(id int) ([]PanelSQL, error)

type PanelScheduledTime

type PanelScheduledTime struct {
	LocationId        int    `json:"locationId"`
	ScheduledTime     string `json:"scheduledTime"`
	DurationInMinutes int    `json:"durationInMinutes"`
}

type PasswordChange

type PasswordChange struct {
	OldPassword string `json:"oldPassword"`
	NewPassword string `json:"newPassword"`
}

type PasswordHashMismatch

type PasswordHashMismatch struct {
	Err error
}

func (*PasswordHashMismatch) Error

func (p *PasswordHashMismatch) Error() string

type ProposedBuilding

type ProposedBuilding struct {
	Name   string `json:"name"`
	City   string `json:"city"`
	Region string `json:"region"`
}

type ProposedFloor

type ProposedFloor struct {
	Name         string `json:"name"`
	BuildingName string `json:"buildingName"`
}

type ProposedLocation

type ProposedLocation struct {
	RoomName   string `json:"name"`
	FloorId    int    `json:"floorId"`
	BuildingId int    `json:"buildingId"`
}

type ProposedPanel

type ProposedPanel struct {
	Topic               string `json:"topic"`
	Description         string `json:"description"`
	PanelRequestorEmail string `json:"panelRequestorEmail"`
}

type ProposedUser

type ProposedUser struct {
	Id       int    `json:"Id"`
	UserName string `json:"userName"`
	Status   string `json:"status" enum:"enabled,disabled"`
	Password string `json:"password"`
}

type Schedule

type Schedule struct {
	StartTime         string `json:"startTime"`
	DurationInMinutes int    `json:"durationInMinutes"`
}

func GetPanelScheduleByPanelId

func GetPanelScheduleByPanelId(id int) (Schedule, error)

type ScheduledEvent

type ScheduledEvent struct {
	Id                int    `json:"Id"`
	LocationId        int    `json:"locationId"`
	EventId           int    `json:"eventId"`
	ScheduledTime     string `json:"scheduledTime"`
	DurationInMinutes int    `json:"durationInMinutes"`
}

type SchedulingConflict

type SchedulingConflict struct {
	Err error
}

func (*SchedulingConflict) Error

func (s *SchedulingConflict) Error() string

type SuccessMsg

type SuccessMsg struct {
	Message string `json:"message"`
}

type User

type User struct {
	Id              int    `json:"Id"`
	UserName        string `json:"userName"`
	Status          string `json:"status"`
	PasswordHash    string `json:"passwordHash"`
	CreationDate    string `json:"creationDate"`
	LastChangedDate string `json:"lastChangedDate"`
}

func GetUserById

func GetUserById(id int) (User, error)

func GetUserByUserName

func GetUserByUserName(username string) (User, error)

func GetUsers

func GetUsers() ([]User, error)

type UserStatus

type UserStatus struct {
	Status string `json:"status" enum:"enabled,disabled"`
}

type UserStatusMsg

type UserStatusMsg struct {
	Message    string `json:"message"`
	UserStatus string `json:"userStatus" enum:"enabled,disabled"`
}

type UsersList

type UsersList struct {
	Data []User `json:"data"`
}

Jump to

Keyboard shortcuts

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