YetAnotherToDoList/graph/model/models_gen.go

128 lines
2.9 KiB
Go
Raw Normal View History

2023-08-19 23:47:36 +02:00
// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
package model
import (
"fmt"
"io"
"strconv"
)
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"`
}
type NewUser struct {
UserName string `json:"userName"`
FullName *string `json:"fullName,omitempty"`
Password string `json:"password"`
}
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"`
}
type RelationRoleUser struct {
User *User `json:"user"`
UserIsRoleManager bool `json:"userIsRoleManager"`
}
type RelationUserRole struct {
Role *Role `json:"role"`
UserIsRoleManager bool `json:"userIsRoleManager"`
}
type Role struct {
ID string `json:"id"`
RoleName string `json:"roleName"`
IsAdmin bool `json:"isAdmin"`
IsUserCreator bool `json:"isUserCreator"`
RoleMembers []*RelationRoleUser `json:"roleMembers"`
}
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"`
}
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"`
Password *string `json:"password,omitempty"`
}
type User struct {
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
}
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()))
}