2023-08-19 23:47:36 +02:00
|
|
|
// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
|
|
|
|
|
|
|
|
package model
|
|
|
|
|
2024-02-02 21:23:32 +01:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"io"
|
|
|
|
"strconv"
|
|
|
|
)
|
|
|
|
|
2023-11-05 17:42:14 +01:00
|
|
|
type NewRefreshToken struct {
|
|
|
|
TokenName *string `json:"tokenName,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type NewRole struct {
|
|
|
|
RoleName string `json:"roleName"`
|
|
|
|
IsAdmin bool `json:"isAdmin"`
|
|
|
|
IsUserCreator bool `json:"isUserCreator"`
|
|
|
|
}
|
|
|
|
|
2023-08-19 23:47:36 +02:00
|
|
|
type NewTodo struct {
|
|
|
|
Text string `json:"text"`
|
|
|
|
UserID string `json:"userId"`
|
|
|
|
}
|
|
|
|
|
2023-10-10 22:26:07 +02:00
|
|
|
type NewUser struct {
|
2023-11-05 17:42:14 +01:00
|
|
|
UserName string `json:"userName"`
|
|
|
|
FullName *string `json:"fullName,omitempty"`
|
|
|
|
Password string `json:"password"`
|
2023-10-10 22:26:07 +02:00
|
|
|
}
|
|
|
|
|
2023-11-05 17:42:14 +01:00
|
|
|
type RefreshToken struct {
|
|
|
|
ID string `json:"id"`
|
|
|
|
ExpiryDate int `json:"expiryDate"`
|
|
|
|
TokenName *string `json:"tokenName,omitempty"`
|
|
|
|
Selector *string `json:"selector,omitempty"`
|
|
|
|
Token *string `json:"token,omitempty"`
|
|
|
|
UserID string `json:"userId"`
|
|
|
|
}
|
|
|
|
|
2023-11-18 15:51:10 +01:00
|
|
|
type RelationRoleUser struct {
|
|
|
|
User *User `json:"user"`
|
|
|
|
UserIsRoleManager bool `json:"userIsRoleManager"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type RelationUserRole struct {
|
|
|
|
Role *Role `json:"role"`
|
|
|
|
UserIsRoleManager bool `json:"userIsRoleManager"`
|
|
|
|
}
|
|
|
|
|
2023-11-05 17:42:14 +01:00
|
|
|
type Role struct {
|
2023-11-18 15:51:10 +01:00
|
|
|
ID string `json:"id"`
|
|
|
|
RoleName string `json:"roleName"`
|
|
|
|
IsAdmin bool `json:"isAdmin"`
|
|
|
|
IsUserCreator bool `json:"isUserCreator"`
|
|
|
|
RoleMembers []*RelationRoleUser `json:"roleMembers"`
|
2023-11-05 17:42:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type UpdateRefreshToken struct {
|
|
|
|
TokenName *string `json:"tokenName,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type UpdateRole struct {
|
|
|
|
RoleName *string `json:"roleName,omitempty"`
|
|
|
|
IsAdmin *bool `json:"isAdmin,omitempty"`
|
|
|
|
IsUserCreator *bool `json:"isUserCreator,omitempty"`
|
2023-10-10 22:26:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
type UpdateTodo struct {
|
|
|
|
Text *string `json:"text,omitempty"`
|
|
|
|
Done *bool `json:"done,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type UpdateUser struct {
|
|
|
|
UserName *string `json:"userName,omitempty"`
|
|
|
|
FullName *string `json:"fullName,omitempty"`
|
2023-11-05 17:42:14 +01:00
|
|
|
Password *string `json:"password,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type User struct {
|
2023-11-18 15:51:10 +01:00
|
|
|
ID string `json:"id"`
|
|
|
|
UserName string `json:"userName"`
|
|
|
|
FullName *string `json:"fullName,omitempty"`
|
|
|
|
Todos []*Todo `json:"todos"`
|
|
|
|
Roles []*RelationUserRole `json:"roles"`
|
2023-08-19 23:47:36 +02:00
|
|
|
}
|
2024-02-02 21:23:32 +01:00
|
|
|
|
|
|
|
type Privilege string
|
|
|
|
|
|
|
|
const (
|
|
|
|
PrivilegeIsAdmin Privilege = "isAdmin"
|
|
|
|
PrivilegeIsUserCreator Privilege = "isUserCreator"
|
|
|
|
)
|
|
|
|
|
|
|
|
var AllPrivilege = []Privilege{
|
|
|
|
PrivilegeIsAdmin,
|
|
|
|
PrivilegeIsUserCreator,
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e Privilege) IsValid() bool {
|
|
|
|
switch e {
|
|
|
|
case PrivilegeIsAdmin, PrivilegeIsUserCreator:
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e Privilege) String() string {
|
|
|
|
return string(e)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *Privilege) UnmarshalGQL(v interface{}) error {
|
|
|
|
str, ok := v.(string)
|
|
|
|
if !ok {
|
|
|
|
return fmt.Errorf("enums must be strings")
|
|
|
|
}
|
|
|
|
|
|
|
|
*e = Privilege(str)
|
|
|
|
if !e.IsValid() {
|
|
|
|
return fmt.Errorf("%s is not a valid Privilege", str)
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e Privilege) MarshalGQL(w io.Writer) {
|
|
|
|
fmt.Fprint(w, strconv.Quote(e.String()))
|
|
|
|
}
|