Locations added
This commit is contained in:
@@ -17,5 +17,7 @@ type Event struct {
|
||||
ScheduleEnd time.Time `bun:"schedule_end,notnull" json:"end"`
|
||||
FullDay bool `bun:"full_day,notnull,default:false" json:"fullDay"`
|
||||
IsVisible bool `bun:"is_visible,notnull,default:true" json:"isVisible"`
|
||||
Description *string `bun:"description" json:"description,omitempty"`
|
||||
Location *string `bun:"location" json:"location,omitempty"`
|
||||
Rrule string `bun:"rrule" json:"rrule"`
|
||||
}
|
||||
|
||||
16
backend/core/models/locations.go
Normal file
16
backend/core/models/locations.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package models
|
||||
|
||||
import "github.com/uptrace/bun"
|
||||
|
||||
type Location struct {
|
||||
bun.BaseModel `bun:"table:locations"`
|
||||
|
||||
ID int `bun:"id,pk,autoincrement" json:"id"`
|
||||
Street string `bun:"street,notnull,unique:location" json:"street"`
|
||||
City string `bun:"city,notnull,unique:location" json:"city"`
|
||||
PostalCode string `bun:"postal_code,notnull,unique:location" json:"postalCode"`
|
||||
Latitude *float64 `bun:"latitude" json:"latitude,omitempty"`
|
||||
Longitude *float64 `bun:"longitude" json:"longitude,omitempty"`
|
||||
|
||||
Events *[]Event `bun:"-" json:"events,omitempty"`
|
||||
}
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
type Permissions []models.Permission
|
||||
|
||||
func GetAllPermissions() Permissions {
|
||||
resources := []string{"users", "roles", "media", "events", "permissions", "shortcodes", "blogs"}
|
||||
resources := []string{"users", "roles", "media", "events", "permissions", "shortcodes", "blogs", "locations"}
|
||||
var perms Permissions
|
||||
for _, resource := range resources {
|
||||
perms = append(perms, Permissions{
|
||||
|
||||
@@ -72,6 +72,9 @@ func InitDatabase(dsn DSN) (*bun.DB, error) {
|
||||
_, err = db.NewCreateTable().
|
||||
Model((*m.UserToRole)(nil)).IfNotExists().Exec(ctx)
|
||||
|
||||
_, err = db.NewCreateTable().
|
||||
Model((*m.Location)(nil)).IfNotExists().Exec(ctx)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user