Files
old-backend/models/company.go

53 lines
1.1 KiB
Go
Raw Normal View History

2023-09-06 11:58:33 +02:00
package models
2023-10-06 10:47:26 +02:00
import (
2023-10-13 11:48:14 +02:00
"database/sql"
2023-10-06 10:47:26 +02:00
"time"
)
type BaseModel struct {
2023-10-13 11:48:14 +02:00
ID uint `json:"id" gorm:"primaryKey"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
DeletedAt sql.NullTime `json:"deletedAt,omitempty" gorm:"index"`
2023-10-06 10:47:26 +02:00
}
2023-10-13 11:48:14 +02:00
2023-09-06 11:58:33 +02:00
type Company struct {
2023-10-13 11:48:14 +02:00
BaseModel
Name string `json:"name"`
Address string `json:"address"`
Email string `json:"email"`
Phone string `json:"phone"`
Users []User `json:"users"`
2023-10-06 10:47:26 +02:00
Devices []Device `json:"devices"`
2023-09-06 11:58:33 +02:00
}
2023-10-30 19:21:43 +01:00
type School struct {
BaseModel
Name string `json:"name"`
Address string `json:"address"`
Students []Student `json:"students" gorm:"foreignKey:SchoolID"`
}
type Student struct {
BaseModel
Name string `json:"name"`
Age int `json:"age"`
SchoolID uint `json:"schoolId" gorm:"index"`
}
2023-10-03 18:26:57 +02:00
type CompanyShortResponse struct {
2023-10-06 10:47:26 +02:00
ID int `json:"id"`
Name string `json:"name"`
2023-10-03 18:26:57 +02:00
}
2023-09-18 12:27:40 +02:00
func (Company) Update() (bool, error) {
2023-09-06 11:58:33 +02:00
return false, nil
}
2023-09-18 12:27:40 +02:00
func (Company) Create() (bool, error) {
2023-09-06 11:58:33 +02:00
return false, nil
}
2023-09-18 12:27:40 +02:00
func (Company) Delete() (bool, error) {
2023-09-06 11:58:33 +02:00
return false, nil
}