add project kontor-api-echo
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/uptrace/bun"
|
||||
)
|
||||
|
||||
type Profile struct {
|
||||
bun.BaseModel `bun:"table:profile"`
|
||||
|
||||
ID string `bun:"id,pk"`
|
||||
CreatedAt time.Time `bun:"created_date,nullzero,notnull,default:current_timestamp"`
|
||||
UpdatedAt time.Time `bun:"last_modified_date,nullzero,notnull,default:current_timestamp"`
|
||||
Version int `bun:"version,default:0"`
|
||||
FirstName string `bun:"first_name"`
|
||||
LastName string `bun:"last_name"`
|
||||
UserName string `bun:"user_name,unique:user_name"`
|
||||
Email string `bun:"email"`
|
||||
Password string `bun:"password"`
|
||||
Enabled bool `bun:"enabled"`
|
||||
Assignments []Assignment `bun:"rel:has-many,join:id=profile_id"`
|
||||
Tokens []Token `bun:"rel:has-many,join:id=profile_id"`
|
||||
}
|
||||
|
||||
type Permission struct {
|
||||
bun.BaseModel `bun:"table:permission"`
|
||||
|
||||
ID string `bun:"id,pk"`
|
||||
CreatedAt time.Time `bun:"created_date,nullzero,notnull,default:current_timestamp"`
|
||||
UpdatedAt time.Time `bun:"last_modified_date,nullzero,notnull,default:current_timestamp"`
|
||||
Version int `bun:"version,default:0"`
|
||||
Name string `bun:"name,unique:name"`
|
||||
Assignments []Assignment `bun:"rel:has-many,join:id=permission_id"`
|
||||
}
|
||||
|
||||
type Token struct {
|
||||
bun.BaseModel `bun:"table:token"`
|
||||
|
||||
ID string `bun:"id,pk"`
|
||||
CreatedAt time.Time `bun:"created_date,nullzero,notnull,default:current_timestamp"`
|
||||
UpdatedAt time.Time `bun:"last_modified_date,nullzero,notnull,default:current_timestamp"`
|
||||
Version int `bun:"version,default:0"`
|
||||
Name string `bun:"name,unique:name"`
|
||||
LastUsedAt time.Time `bun:"last_used_date,nullzero,notnull,default:current_timestamp"`
|
||||
Enabled bool `bun:"enabled,default:true"`
|
||||
ProfileID *string `bun:"profile_id"`
|
||||
Profile *Profile `bun:"rel:belongs-to,join:profile_id=id"`
|
||||
}
|
||||
|
||||
type Assignment struct {
|
||||
bun.BaseModel `bun:"table:assignment"`
|
||||
|
||||
ID string `bun:"id,pk"`
|
||||
CreatedAt time.Time `bun:"created_date,nullzero,notnull,default:current_timestamp"`
|
||||
UpdatedAt time.Time `bun:"last_modified_date,nullzero,notnull,default:current_timestamp"`
|
||||
Version int `bun:"version,default:0"`
|
||||
ProfileID *string `bun:"profile_id"`
|
||||
Profile *Profile `bun:"rel:belongs-to,join:profile_id=id"`
|
||||
PermissionID *string `bun:"permission_id"`
|
||||
Permission *Permission `bun:"rel:belongs-to,join:permission_id=id"`
|
||||
}
|
||||
Reference in New Issue
Block a user