48 lines
1.4 KiB
Go
48 lines
1.4 KiB
Go
package model
|
|
|
|
import (
|
|
"github.com/google/uuid"
|
|
"gorm.io/gorm"
|
|
"time"
|
|
)
|
|
|
|
// swagger:model Event
|
|
type Event struct {
|
|
gorm.Model `json:"meta"`
|
|
ID uuid.UUID `json:"id" gorm:"type:uuid;default:gen_random_uuid();primarykey"`
|
|
Start time.Time `json:"start"`
|
|
End time.Time `json:"end"`
|
|
Author User `json:"author" gorm:"-"`
|
|
AuthorId uuid.UUID `json:"-"`
|
|
Medic User `json:"medic" gorm:"-"`
|
|
MedicId uuid.UUID `json:"-"`
|
|
Person PersonalInformationApi `json:"person" gorm:"-"`
|
|
PersonId uuid.UUID `json:"-"`
|
|
OrgId uuid.UUID `json:"-"`
|
|
}
|
|
|
|
// swagger:model CreateEvent
|
|
type CreateEvent struct {
|
|
// The event start time
|
|
// example: 2023-08-02T19:21:23.617Z
|
|
// required: true
|
|
Start time.Time `json:"start" validate:"required,gt"`
|
|
// The event end time
|
|
// example: 2023-08-02T19:21:23.617Z
|
|
// required: true
|
|
End time.Time `json:"end" validate:"required,gtfield=Start"`
|
|
// The person information
|
|
// required: true
|
|
Person *PersonalInformation `json:"person" validate:"required,dive"`
|
|
// The UUID of a medic
|
|
// example: 6204037c-30e6-408b-8aaa-dd8219860b4b
|
|
// required: true
|
|
MedicId uuid.UUID `json:"medic_id" validate:"required"`
|
|
}
|
|
|
|
// swagger:parameters CreateEvent
|
|
type CreateEventArg struct {
|
|
//in: body
|
|
CreateEvent *CreateEvent
|
|
}
|