models

package
v0.0.0-...-833fa1d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllOrdering = []Ordering{
	OrderingAsc,
	OrderingDesc,
}

Functions

func DeletedAt

func DeletedAt(t gorm.DeletedAt) *time.Time

Types

type Account

type Account struct {
	// The primary key of the Account
	ID uint64 `json:"ID"`
	// Status of Account active
	Status ApproveStatus `json:"status"`
	// Message which defined during user approve/rejection process
	StatusMessage *string `json:"statusMessage,omitempty"`
	Title         string  `json:"title"`
	Description   string  `json:"description"`
	// logoURI is an URL string that references a logo for the client.
	LogoURI string `json:"logoURI"`
	// policyURI is a URL string that points to a human-readable privacy policy document
	// that describes how the deployment organization collects, uses,
	// retains, and discloses personal data.
	PolicyURI string `json:"policyURI"`
	// termsOfServiceURI is a URL string that points to a human-readable terms of service
	// document for the client that describes a contractual relationship
	// between the end-user and the client that the end-user accepts when
	// authorizing the client.
	TermsOfServiceURI string `json:"termsOfServiceURI"`
	// clientURI is an URL string of a web page providing information about the client.
	// If present, the server SHOULD display this URL to the end-user in
	// a clickable fashion.
	ClientURI string `json:"clientURI"`
	// contacts is a array of strings representing ways to contact people responsible
	// for this client, typically email addresses.
	Contacts  []string  `json:"contacts,omitempty"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

Account is a company account that can be used to login to the system.

func FromAccountModel

func FromAccountModel(acc *model.Account) *Account

FromAccountModel to local graphql model

func FromAccountModelList

func FromAccountModelList(list []*model.Account) []*Account

FromAccountModelList converts model list to local model list

type AccountCreateInput

type AccountCreateInput struct {
	OwnerID  *uint64       `json:"ownerID,omitempty"`
	Owner    *UserInput    `json:"owner,omitempty"`
	Account  *AccountInput `json:"account"`
	Password string        `json:"password"`
}

type AccountCreatePayload

type AccountCreatePayload struct {
	// A unique identifier for the client performing the mutation.
	ClientMutationID string `json:"clientMutationID"`
	// The account object
	Account *Account `json:"account"`
	// The user object
	Owner *User `json:"owner"`
}

type AccountEdge

type AccountEdge struct {
	// A cursor for use in pagination.
	Cursor string `json:"cursor"`
	// The item at the end of the edge.
	Node *Account `json:"node,omitempty"`
}

type AccountInput

type AccountInput struct {
	Status            *ApproveStatus `json:"status,omitempty"`
	Title             *string        `json:"title,omitempty"`
	Description       *string        `json:"description,omitempty"`
	LogoURI           *string        `json:"logoURI,omitempty"`
	PolicyURI         *string        `json:"policyURI,omitempty"`
	TermsOfServiceURI *string        `json:"termsOfServiceURI,omitempty"`
	ClientURI         *string        `json:"clientURI,omitempty"`
	Contacts          []string       `json:"contacts,omitempty"`
}

func (*AccountInput) Model

func (acc *AccountInput) Model(appStatus ...model.ApproveStatus) *model.Account

Model converts local graphql model to model

type AccountListFilter

type AccountListFilter struct {
	ID     []uint64        `json:"ID,omitempty"`
	UserID []uint64        `json:"UserID,omitempty"`
	Title  []string        `json:"title,omitempty"`
	Status []ApproveStatus `json:"status,omitempty"`
}

func (*AccountListFilter) Filter

func (fl *AccountListFilter) Filter() *account.Filter

Filter converts local graphql model to filter

type AccountListOrder

type AccountListOrder struct {
	ID     *Ordering `json:"ID,omitempty"`
	Title  *Ordering `json:"title,omitempty"`
	Status *Ordering `json:"status,omitempty"`
}

func (*AccountListOrder) Order

func (ord *AccountListOrder) Order() *account.ListOrder

type AccountPayload

type AccountPayload struct {
	// A unique identifier for the client performing the mutation.
	ClientMutationID string `json:"clientMutationID"`
	// Account ID operation result
	AccountID uint64 `json:"accountID"`
	// Account object accessor
	Account *Account `json:"account,omitempty"`
}

AccountPayload wrapper to access of Account oprtation results

type ActiveStatus

type ActiveStatus string

The list of statuses that shows is particular object active or paused

const (
	// All object by default have to be paused
	ActiveStatusPaused ActiveStatus = "PAUSED"
	// Status of the active object
	ActiveStatusActive ActiveStatus = "ACTIVE"
)

func (ActiveStatus) IsValid

func (e ActiveStatus) IsValid() bool

func (ActiveStatus) MarshalGQL

func (e ActiveStatus) MarshalGQL(w io.Writer)

func (ActiveStatus) String

func (e ActiveStatus) String() string

func (*ActiveStatus) UnmarshalGQL

func (e *ActiveStatus) UnmarshalGQL(v interface{}) error

type ApproveStatus

type ApproveStatus string

The list of statuses that shows is object approved or not

const (
	// Pending status of the just inited objects
	ApproveStatusPending ApproveStatus = "PENDING"
	// Approved status of object could be obtained from the some authorized user who have permissions
	ApproveStatusApproved ApproveStatus = "APPROVED"
	// Rejected status of object could be obtained from the some authorized user who have permissions
	ApproveStatusRejected ApproveStatus = "REJECTED"
)

func ApproveStatusFrom

func ApproveStatusFrom(status model.ApproveStatus) ApproveStatus

ApproveStatusFrom model value

func (ApproveStatus) IsValid

func (e ApproveStatus) IsValid() bool

func (ApproveStatus) MarshalGQL

func (e ApproveStatus) MarshalGQL(w io.Writer)

func (*ApproveStatus) ModelStatus

func (status *ApproveStatus) ModelStatus() model.ApproveStatus

ModelStatus returns status type from models

func (ApproveStatus) String

func (e ApproveStatus) String() string

func (*ApproveStatus) UnmarshalGQL

func (e *ApproveStatus) UnmarshalGQL(v interface{}) error

type AuthClient

type AuthClient struct {
	// ClientID is the client ID which represents unique connection indentificator
	ID        string `json:"ID"`
	AccountID uint64 `json:"accountID"`
	UserID    uint64 `json:"userID"`
	// Title of the AuthClient as himan readable name
	Title string `json:"title"`
	// Secret is the client's secret. The secret will be included in the create request as cleartext, and then
	// never again. The secret is stored using BCrypt so it is impossible to recover it. Tell your users
	// that they need to write the secret down as it will not be made available again.
	Secret string `json:"secret"`
	// RedirectURIs is an array of allowed redirect urls for the client, for example http://mydomain/oauth/callback .
	RedirectURIs []string `json:"redirectURIs,omitempty"`
	// GrantTypes is an array of grant types the client is allowed to use.
	//
	// Pattern: client_credentials|authorization_code|implicit|refresh_token
	GrantTypes []string `json:"grantTypes,omitempty"`
	// ResponseTypes is an array of the OAuth 2.0 response type strings that the client can
	// use at the authorization endpoint.
	//
	// Pattern: id_token|code|token
	ResponseTypes []string `json:"responseTypes,omitempty"`
	// Scope is a string containing a space-separated list of scope values (as
	// described in Section 3.3 of OAuth 2.0 [RFC6749]) that the client
	// can use when requesting access tokens.
	//
	// Pattern: ([a-zA-Z0-9\.\*]+\s?)+
	Scope string `json:"scope"`
	// Audience is a whitelist defining the audiences this client is allowed to request tokens for. An audience limits
	// the applicability of an OAuth 2.0 Access Token to, for example, certain API endpoints. The value is a list
	// of URLs. URLs MUST NOT contain whitespaces.
	Audience []string `json:"audience,omitempty"`
	// SubjectType requested for responses to this Client. The subject_types_supported Discovery parameter contains a
	// list of the supported subject_type values for this server. Valid types include `pairwise` and `public`.
	SubjectType string `json:"subjectType"`
	// AllowedCORSOrigins are one or more URLs (scheme://host[:port]) which are allowed to make CORS requests
	// to the /oauth/token endpoint. If this array is empty, the sever's CORS origin configuration (`CORS_ALLOWED_ORIGINS`)
	// will be used instead. If this array is set, the allowed origins are appended to the server's CORS origin configuration.
	// Be aware that environment variable `CORS_ENABLED` MUST be set to `true` for this to work.
	AllowedCORSOrigins []string `json:"allowedCORSOrigins,omitempty"`
	// Public flag tells that the client is public
	Public bool `json:"public"`
	// ExpiresAt contins the time of expiration of the client
	ExpiresAt time.Time  `json:"expiresAt"`
	CreatedAt time.Time  `json:"createdAt"`
	UpdatedAt time.Time  `json:"updatedAt"`
	DeletedAt *time.Time `json:"deletedAt,omitempty"`
}

AuthClient object represents an OAuth 2.0 client

func FromAuthClientModel

func FromAuthClientModel(acc *model.AuthClient) *AuthClient

FromAuthClientModel to local graphql model

func FromAuthClientModelList

func FromAuthClientModelList(list []*model.AuthClient) []*AuthClient

FromAuthClientModelList converts model list to local model list

type AuthClientEdge

type AuthClientEdge struct {
	// A cursor for use in pagination.
	Cursor string `json:"cursor"`
	// The item at the end of the edge.
	Node *AuthClient `json:"node,omitempty"`
}

type AuthClientInput

type AuthClientInput struct {
	AccountID          *uint64    `json:"accountID,omitempty"`
	UserID             *uint64    `json:"userID,omitempty"`
	Title              *string    `json:"title,omitempty"`
	Secret             *string    `json:"secret,omitempty"`
	RedirectURIs       []string   `json:"redirectURIs,omitempty"`
	GrantTypes         []string   `json:"grantTypes,omitempty"`
	ResponseTypes      []string   `json:"responseTypes,omitempty"`
	Scope              *string    `json:"scope,omitempty"`
	Audience           []string   `json:"audience,omitempty"`
	SubjectType        string     `json:"subjectType"`
	AllowedCORSOrigins []string   `json:"allowedCORSOrigins,omitempty"`
	Public             *bool      `json:"public,omitempty"`
	ExpiresAt          *time.Time `json:"expiresAt,omitempty"`
}

type AuthClientListFilter

type AuthClientListFilter struct {
	ID        []string `json:"ID,omitempty"`
	UserID    []uint64 `json:"userID,omitempty"`
	AccountID []uint64 `json:"accountID,omitempty"`
	Public    *bool    `json:"public,omitempty"`
}

type AuthClientListOrder

type AuthClientListOrder struct {
	ID         *Ordering `json:"ID,omitempty"`
	UserID     *Ordering `json:"userID,omitempty"`
	AccountID  *Ordering `json:"accountID,omitempty"`
	Title      *Ordering `json:"title,omitempty"`
	Public     *Ordering `json:"public,omitempty"`
	LastUpdate *Ordering `json:"lastUpdate,omitempty"`
}

type AuthClientPayload

type AuthClientPayload struct {
	// A unique identifier for the client performing the mutation.
	ClientMutationID string `json:"clientMutationID"`
	// AuthClient ID operation result
	AuthClientID string `json:"authClientID"`
	// AuthClient object accessor
	AuthClient *AuthClient `json:"authClient,omitempty"`
}

AuthClientPayload wrapper to access of AuthClient oprtation results

type AvailableStatus

type AvailableStatus string

The list of statuses that shows is particular object is available

const (
	// All object by default have to be undefined
	AvailableStatusUndefined AvailableStatus = "UNDEFINED"
	// Status of the available object
	AvailableStatusAvailable AvailableStatus = "AVAILABLE"
	// Status of the unavailable object
	AvailableStatusUnavailable AvailableStatus = "UNAVAILABLE"
)

func AvailableStatusFrom

func AvailableStatusFrom(status model.AvailableStatus) AvailableStatus

AvailableStatusFrom model value

func (AvailableStatus) IsValid

func (e AvailableStatus) IsValid() bool

func (AvailableStatus) MarshalGQL

func (e AvailableStatus) MarshalGQL(w io.Writer)

func (*AvailableStatus) ModelStatus

func (status *AvailableStatus) ModelStatus() model.AvailableStatus

ModelStatus returns status type from models

func (AvailableStatus) String

func (e AvailableStatus) String() string

func (*AvailableStatus) UnmarshalGQL

func (e *AvailableStatus) UnmarshalGQL(v interface{}) error

type HistoryAction

type HistoryAction struct {
	ID         uuid.UUID          `json:"ID"`
	RequestID  string             `json:"RequestID"`
	Name       string             `json:"name"`
	Message    string             `json:"message"`
	UserID     uint64             `json:"userID"`
	AccountID  uint64             `json:"accountID"`
	ObjectType string             `json:"objectType"`
	ObjectID   uint64             `json:"objectID"`
	ObjectIDs  string             `json:"objectIDs"`
	Data       types.NullableJSON `json:"data"`
	ActionAt   time.Time          `json:"actionAt"`
}

HistoryAction is the model for history actions.

func FromHistoryAction

func FromHistoryAction(action *model.HistoryAction) *HistoryAction

FromHistoryAction converts HistoryAction to HistoryAction

func FromHistoryActionModelList

func FromHistoryActionModelList(list []*model.HistoryAction) []*HistoryAction

FromHistoryActionModelList converts list of HistoryAction to list of HistoryAction

type HistoryActionEdge

type HistoryActionEdge struct {
	// The item at the end of the edge.
	Node *HistoryAction `json:"node"`
	// A cursor for use in pagination.
	Cursor string `json:"cursor"`
}

Edge of action history object.

type HistoryActionListFilter

type HistoryActionListFilter struct {
	ID []uuid.UUID `json:"ID,omitempty"`
	// The request ID of the action
	RequestID []string `json:"RequestID,omitempty"`
	// The name of the action
	Name []string `json:"name,omitempty"`
	// List of users who made the action
	UserID []uint64 `json:"userID,omitempty"`
	// List of accounts that the user belongs to
	AccountID []uint64 `json:"accountID,omitempty"`
	// Type of the object that the action is performed on
	ObjectType []string `json:"objectType,omitempty"`
	// Object ID of the model that the action is performed on
	ObjectID []uint64 `json:"objectID,omitempty"`
	// Object ID string version of the model that the action is performed on
	ObjectIDs []string `json:"objectIDs,omitempty"`
}

func (*HistoryActionListFilter) Filter

func (filter *HistoryActionListFilter) Filter() *historylog.Filter

type HistoryActionListOrder

type HistoryActionListOrder struct {
	ID         *Ordering `json:"ID,omitempty"`
	RequestID  *Ordering `json:"RequestID,omitempty"`
	Name       *Ordering `json:"name,omitempty"`
	UserID     *Ordering `json:"userID,omitempty"`
	AccountID  *Ordering `json:"accountID,omitempty"`
	ObjectType *Ordering `json:"objectType,omitempty"`
	ObjectID   *Ordering `json:"objectID,omitempty"`
	ObjectIDs  *Ordering `json:"objectIDs,omitempty"`
	ActionAt   *Ordering `json:"actionAt,omitempty"`
}

HistoryActionListOptions contains the options for listing history actions ordering.

func (*HistoryActionListOrder) Order

func (order *HistoryActionListOrder) Order() *historylog.Order

type HistoryActionPayload

type HistoryActionPayload struct {
	// The client mutation id
	ClientMutationID *string `json:"clientMutationId,omitempty"`
	// The history action object ID
	ActionID uuid.UUID `json:"actionID"`
	// The action object
	Action *HistoryAction `json:"action"`
}

HistoryActionPayload contains the information about a history action.

type InviteMemberInput

type InviteMemberInput struct {
	// The email of the member to invite
	Email string `json:"email"`
	// The roles to assign to the member
	Roles []string `json:"roles"`
	// Is the user an admin of the account
	IsAdmin bool `json:"isAdmin"`
}

func (*InviteMemberInput) AllRoles

func (mem *InviteMemberInput) AllRoles() []string

type Member

type Member struct {
	// The primary key of the Member
	ID uint64 `json:"ID"`
	// Status of Member active
	Status ApproveStatus `json:"status"`
	// User object accessor
	User *User `json:"user"`
	// Account object accessor
	Account *Account `json:"account"`
	// Is the user an admin of the account
	IsAdmin bool `json:"isAdmin"`
	// Roles of the member
	Roles     []*RBACRole `json:"roles,omitempty"`
	CreatedAt time.Time   `json:"createdAt"`
	UpdatedAt time.Time   `json:"updatedAt"`
	DeletedAt *time.Time  `json:"deletedAt,omitempty"`
}

Account Member represents a member of the account

func FromMemberModel

func FromMemberModel(ctx context.Context, member *model.AccountMember) *Member

FromMemberModel to local graphql model

func FromMemberModelList

func FromMemberModelList(ctx context.Context, list []*model.AccountMember) []*Member

type MemberEdge

type MemberEdge struct {
	// A cursor for use in pagination.
	Cursor string `json:"cursor"`
	// The item at the end of the edge.
	Node *Member `json:"node,omitempty"`
}

type MemberInput

type MemberInput struct {
	// The roles to assign to the member
	Roles []string `json:"roles"`
	// Is the user an admin of the account
	IsAdmin bool `json:"isAdmin"`
}

func (*MemberInput) AllRoles

func (mem *MemberInput) AllRoles() []string

type MemberListFilter

type MemberListFilter struct {
	ID        []uint64        `json:"ID,omitempty"`
	Status    []ApproveStatus `json:"status,omitempty"`
	UserID    []uint64        `json:"userID,omitempty"`
	AccountID []uint64        `json:"accountID,omitempty"`
	IsAdmin   *bool           `json:"isAdmin,omitempty"`
}

func (*MemberListFilter) Filter

func (fl *MemberListFilter) Filter() *account.MemberFilter

type MemberListOrder

type MemberListOrder struct {
	ID        *Ordering `json:"ID,omitempty"`
	Status    *Ordering `json:"status,omitempty"`
	UserID    *Ordering `json:"userID,omitempty"`
	AccountID *Ordering `json:"accountID,omitempty"`
	IsAdmin   *Ordering `json:"isAdmin,omitempty"`
	CreatedAt *Ordering `json:"createdAt,omitempty"`
	UpdatedAt *Ordering `json:"updatedAt,omitempty"`
}

func (*MemberListOrder) Order

func (ord *MemberListOrder) Order() *account.MemberListOrder

type MemberPayload

type MemberPayload struct {
	// A unique identifier for the client performing the mutation.
	ClientMutationID string `json:"clientMutationID"`
	// Member ID operation result
	MemberID uint64 `json:"memberID"`
	// Member object accessor
	Member *Member `json:"member,omitempty"`
}

type MessangerType

type MessangerType string
const (
	MessangerTypeSkype    MessangerType = "SKYPE"
	MessangerTypeAim      MessangerType = "AIM"
	MessangerTypeIcq      MessangerType = "ICQ"
	MessangerTypeWhatsapp MessangerType = "WHATSAPP"
	MessangerTypeTelegram MessangerType = "TELEGRAM"
	MessangerTypeViber    MessangerType = "VIBER"
	MessangerTypePhone    MessangerType = "PHONE"
)

func (MessangerType) IsValid

func (e MessangerType) IsValid() bool

func (MessangerType) MarshalGQL

func (e MessangerType) MarshalGQL(w io.Writer)

func (MessangerType) String

func (e MessangerType) String() string

func (*MessangerType) UnmarshalGQL

func (e *MessangerType) UnmarshalGQL(v interface{}) error

type Mutation

type Mutation struct {
}

type Option

type Option struct {
	OptionType OptionType          `json:"optionType"`
	TargetID   uint64              `json:"targetID"`
	Name       string              `json:"name"`
	Value      *types.NullableJSON `json:"value,omitempty"`
}

Option type definition represents a single option of the user or the system.

func FromOption

func FromOption(opt *model.Option) *Option

func FromOptionModelList

func FromOptionModelList(opts []*model.Option) []*Option

type OptionEdge

type OptionEdge struct {
	Cursor string  `json:"cursor"`
	Node   *Option `json:"node"`
}

The edge type for Option.

type OptionInput

type OptionInput struct {
	// The type of the option.
	OptionType OptionType `json:"optionType"`
	// The target ID of the option.
	TargetID uint64 `json:"targetID"`
	// Value of the option.
	Value *types.NullableJSON `json:"value,omitempty"`
}

type OptionListFilter

type OptionListFilter struct {
	OptionType  []OptionType `json:"optionType,omitempty"`
	TargetID    []uint64     `json:"targetID,omitempty"`
	Name        []string     `json:"name,omitempty"`
	NamePattern []string     `json:"namePattern,omitempty"`
}

func (*OptionListFilter) Filter

func (fl *OptionListFilter) Filter() *option.Filter

type OptionListOrder

type OptionListOrder struct {
	OptionType *Ordering `json:"optionType,omitempty"`
	TargetID   *Ordering `json:"targetID,omitempty"`
	Name       *Ordering `json:"name,omitempty"`
	Value      *Ordering `json:"value,omitempty"`
}

func (*OptionListOrder) Order

func (ol *OptionListOrder) Order() *option.ListOrder

type OptionPayload

type OptionPayload struct {
	// A unique identifier for the client performing the mutation.
	ClientMutationID string  `json:"clientMutationId"`
	OptionName       string  `json:"optionName"`
	Option           *Option `json:"option,omitempty"`
}

type OptionType

type OptionType string
const (
	OptionTypeUndefined OptionType = "UNDEFINED"
	OptionTypeUser      OptionType = "USER"
	OptionTypeAccount   OptionType = "ACCOUNT"
	OptionTypeSystem    OptionType = "SYSTEM"
)

func FromOptionType

func FromOptionType(tp model.OptionType) OptionType

func (OptionType) IsValid

func (e OptionType) IsValid() bool

func (OptionType) MarshalGQL

func (e OptionType) MarshalGQL(w io.Writer)

func (OptionType) ModelType

func (tp OptionType) ModelType() model.OptionType

func (OptionType) String

func (e OptionType) String() string

func (*OptionType) UnmarshalGQL

func (e *OptionType) UnmarshalGQL(v interface{}) error

type Ordering

type Ordering string

Constants of the order of data

const (
	// Ascending ordering of data
	OrderingAsc Ordering = "ASC"
	// Descending ordering of data
	OrderingDesc Ordering = "DESC"
)

func (*Ordering) AsOrder

func (order *Ordering) AsOrder() model.Order

func (*Ordering) Int8

func (order *Ordering) Int8() int8

func (Ordering) IsValid

func (e Ordering) IsValid() bool

func (Ordering) MarshalGQL

func (e Ordering) MarshalGQL(w io.Writer)

func (Ordering) String

func (e Ordering) String() string

func (*Ordering) UnmarshalGQL

func (e *Ordering) UnmarshalGQL(v interface{}) error

type Page

type Page struct {
	// Start after the cursor ID
	After *string `json:"after,omitempty"`
	// Page number to start at (0-based), defaults to 0 (0, 1, 2, etc.)
	StartPage *int `json:"startPage,omitempty"`
	// Maximum number of items to return
	Size *int `json:"size,omitempty"`
}

Information for paginating

func (*Page) Pagination

func (p *Page) Pagination() *repository.Pagination

type PageInfo

type PageInfo struct {
	// When paginating backwards, the cursor to continue.
	StartCursor string `json:"startCursor"`
	// When paginating forwards, the cursor to continue.
	EndCursor string `json:"endCursor"`
	// When paginating backwards, are there more items?
	HasPreviousPage bool `json:"hasPreviousPage"`
	// When paginating forwards, are there more items?
	HasNextPage bool `json:"hasNextPage"`
	// Total number of pages available
	Total int `json:"total"`
	// Current page number
	Page int `json:"page"`
	// Number of pages
	Count int `json:"count"`
}

Information for paginating

type Profile

type Profile struct {
	ID          uint64              `json:"ID"`
	User        *User               `json:"user"`
	FirstName   string              `json:"firstName"`
	LastName    string              `json:"lastName"`
	CompanyName string              `json:"companyName"`
	About       string              `json:"about"`
	Email       string              `json:"email"`
	Messgangers []*ProfileMessanger `json:"messgangers,omitempty"`
	CreatedAt   time.Time           `json:"createdAt"`
	UpdatedAt   time.Time           `json:"updatedAt"`
}

type ProfileMessanger

type ProfileMessanger struct {
	Mtype   MessangerType `json:"mtype"`
	Address string        `json:"address"`
}

type Query

type Query struct {
}

type RBACPermission

type RBACPermission struct {
	Name        string  `json:"name"`
	Object      string  `json:"object"`
	Access      string  `json:"access"`
	Fullname    string  `json:"fullname"`
	Description *string `json:"description,omitempty"`
}

func FromRBACPermissionModel

func FromRBACPermissionModel(perm mrbac.Permission) *RBACPermission

func FromRBACPermissionModelList

func FromRBACPermissionModelList(perms []mrbac.Permission) []*RBACPermission

FromRBACPermissionModelList converts model list to local model list

type RBACRole

type RBACRole struct {
	ID          uint64  `json:"ID"`
	Name        string  `json:"name"`
	Title       string  `json:"title"`
	Description *string `json:"description,omitempty"`
	//  Context is a JSON object that defines the context of the role.
	//  The context is used to determine whether the role is applicable to the object.
	//  The context is a JSON object with the following structure:
	//
	// {"cover": "system", "object": "role"}
	//
	//  where:
	// "cover" - is a name of the cover area of the object type
	// "object" - is a name of the object type <module>:<object-name>
	Context            *types.NullableJSON `json:"context,omitempty"`
	ChildRoles         []*RBACRole         `json:"childRoles,omitempty"`
	Permissions        []*RBACPermission   `json:"permissions,omitempty"`
	PermissionPatterns []string            `json:"permissionPatterns,omitempty"`
	CreatedAt          time.Time           `json:"createdAt"`
	UpdatedAt          time.Time           `json:"updatedAt"`
	DeletedAt          *time.Time          `json:"deletedAt,omitempty"`
}

A role is a collection of permissions. A role can be a child of another role.

func FromRBACRoleModel

func FromRBACRoleModel(ctx context.Context, role *model.Role) *RBACRole

FromRBACRoleModel to local graphql model

func FromRBACRoleModelList

func FromRBACRoleModelList(ctx context.Context, list []*model.Role) []*RBACRole

FromRBACRoleModelList converts model list to local model list

type RBACRoleEdge

type RBACRoleEdge struct {
	// A cursor for use in pagination.
	Cursor string `json:"cursor"`
	// The item at the end of the edge.
	Node *RBACRole `json:"node,omitempty"`
}

RBACRoleEdge is a connection edge type for RBACRole.

type RBACRoleInput

type RBACRoleInput struct {
	Name        *string             `json:"name,omitempty"`
	Title       *string             `json:"title,omitempty"`
	Context     *types.NullableJSON `json:"context,omitempty"`
	Permissions []string            `json:"permissions,omitempty"`
}

type RBACRoleListFilter

type RBACRoleListFilter struct {
	ID   []uint64 `json:"ID,omitempty"`
	Name []string `json:"name,omitempty"`
}

func (*RBACRoleListFilter) Filter

func (fl *RBACRoleListFilter) Filter() *rbac.Filter

type RBACRoleListOrder

type RBACRoleListOrder struct {
	ID    *Ordering `json:"ID,omitempty"`
	Name  *Ordering `json:"name,omitempty"`
	Title *Ordering `json:"title,omitempty"`
}

func (*RBACRoleListOrder) Order

func (ol *RBACRoleListOrder) Order() *rbac.Order

type RBACRolePayload

type RBACRolePayload struct {
	// A unique identifier for the client performing the mutation.
	ClientMutationID string `json:"clientMutationID"`
	// Role ID operation result
	RoleID uint64 `json:"roleID"`
	// Role object accessor
	Role *RBACRole `json:"role,omitempty"`
}

RBACRolePayload wrapper to access of RBACRole oprtation results

type ResponseStatus

type ResponseStatus string

Constants of the response status

const (
	// Success status of the response
	ResponseStatusSuccess ResponseStatus = "SUCCESS"
	// Error status of the response
	ResponseStatusError ResponseStatus = "ERROR"
)

func (ResponseStatus) IsValid

func (e ResponseStatus) IsValid() bool

func (ResponseStatus) MarshalGQL

func (e ResponseStatus) MarshalGQL(w io.Writer)

func (ResponseStatus) String

func (e ResponseStatus) String() string

func (*ResponseStatus) UnmarshalGQL

func (e *ResponseStatus) UnmarshalGQL(v interface{}) error

type SessionToken

type SessionToken struct {
	Token     string    `json:"token"`
	ExpiresAt time.Time `json:"expiresAt"`
	IsAdmin   bool      `json:"isAdmin"`
	Roles     []string  `json:"roles,omitempty"`
}

SessionToken object represents an OAuth 2.0 / JWT session token

type SocialAccount

type SocialAccount struct {
	ID        uint64             `json:"ID"`
	UserID    uint64             `json:"userID"`
	SocialID  string             `json:"socialID"`
	Provider  string             `json:"provider"`
	Email     string             `json:"email"`
	Username  string             `json:"username"`
	FirstName string             `json:"firstName"`
	LastName  string             `json:"lastName"`
	Avatar    string             `json:"avatar"`
	Link      string             `json:"link"`
	Data      types.NullableJSON `json:"data"`
	// Social Account session object accessor
	Sessions  []*SocialAccountSession `json:"sessions,omitempty"`
	CreatedAt time.Time               `json:"createdAt"`
	UpdatedAt time.Time               `json:"updatedAt"`
	DeletedAt *time.Time              `json:"deletedAt,omitempty"`
}

func FromSocialAccountModel

func FromSocialAccountModel(acc *model.AccountSocial) *SocialAccount

func FromSocialAccountModelList

func FromSocialAccountModelList(list []*model.AccountSocial) []*SocialAccount

type SocialAccountEdge

type SocialAccountEdge struct {
	// A cursor for use in pagination.
	Cursor string `json:"cursor"`
	// The item at the end of the edge.
	Node *SocialAccount `json:"node,omitempty"`
}

type SocialAccountListFilter

type SocialAccountListFilter struct {
	ID       []uint64 `json:"ID,omitempty"`
	UserID   []uint64 `json:"userID,omitempty"`
	Provider []string `json:"provider,omitempty"`
	Username []string `json:"username,omitempty"`
	Email    []string `json:"email,omitempty"`
}

func (*SocialAccountListFilter) Filter

type SocialAccountListOrder

type SocialAccountListOrder struct {
	ID        *Ordering `json:"ID,omitempty"`
	UserID    *Ordering `json:"userID,omitempty"`
	Provider  *Ordering `json:"provider,omitempty"`
	Email     *Ordering `json:"email,omitempty"`
	Username  *Ordering `json:"username,omitempty"`
	FirstName *Ordering `json:"firstName,omitempty"`
	LastName  *Ordering `json:"lastName,omitempty"`
}

func (*SocialAccountListOrder) Order

type SocialAccountPayload

type SocialAccountPayload struct {
	// A unique identifier for the client performing the mutation.
	ClientMutationID string `json:"clientMutationID"`
	// Social Account ID operation result
	SocialAccountID uint64 `json:"socialAccountID"`
	// Social Account object accessor
	SocialAccount *SocialAccount `json:"socialAccount,omitempty"`
}

SocialAccountPayload wrapper to access of SocialAccount oprtation results

type SocialAccountSession

type SocialAccountSession struct {
	// The unique name of the session to destinguish between different sessions with different scopes
	Name            string     `json:"name"`
	SocialAccountID uint64     `json:"socialAccountID"`
	TokenType       string     `json:"tokenType"`
	AccessToken     string     `json:"accessToken"`
	RefreshToken    string     `json:"refreshToken"`
	Scope           []string   `json:"scope,omitempty"`
	CreatedAt       time.Time  `json:"createdAt"`
	UpdatedAt       time.Time  `json:"updatedAt"`
	ExpiresAt       *time.Time `json:"expiresAt,omitempty"`
	DeletedAt       *time.Time `json:"deletedAt,omitempty"`
}

func FromSocialAccountSessionModel

func FromSocialAccountSessionModel(sess *model.AccountSocialSession) *SocialAccountSession

func FromSocialAccountSessionModelList

func FromSocialAccountSessionModelList(list []*model.AccountSocialSession) []*SocialAccountSession

type StatusResponse

type StatusResponse struct {
	// The status of the response
	Status ResponseStatus `json:"status"`
	// The message of the response
	Message *string `json:"message,omitempty"`
}

Simple response type for the API

type User

type User struct {
	// The primary key of the user
	ID uint64 `json:"ID"`
	// Unical user name
	Username string `json:"username"`
	// Status of user active
	Status ApproveStatus `json:"status"`
	// Message which defined during user approve/rejection process
	StatusMessage *string   `json:"statusMessage,omitempty"`
	CreatedAt     time.Time `json:"createdAt"`
	UpdatedAt     time.Time `json:"updatedAt"`
}

User represents a user object of the system

func FromUserModel

func FromUserModel(u *model.User) *User

FromUserModel to local graphql model

func FromUserModelList

func FromUserModelList(list []*model.User) []*User

FromUserModelList converts model list to local model list

type UserEdge

type UserEdge struct {
	// A cursor for use in pagination.
	Cursor string `json:"cursor"`
	// The item at the end of the edge.
	Node *User `json:"node,omitempty"`
}

type UserInput

type UserInput struct {
	Username *string        `json:"username,omitempty"`
	Status   *ApproveStatus `json:"status,omitempty"`
}

func (*UserInput) Model

func (usr *UserInput) Model(appStatus ...model.ApproveStatus) *model.User

type UserListFilter

type UserListFilter struct {
	ID        []uint64 `json:"ID,omitempty"`
	AccountID []uint64 `json:"accountID,omitempty"`
	Emails    []string `json:"emails,omitempty"`
	Roles     []uint64 `json:"roles,omitempty"`
}

UserListFilter implements filter for user list query

func (*UserListFilter) Filter

func (fl *UserListFilter) Filter() *user.ListFilter

Filter converts local graphql model to filter

type UserListOrder

type UserListOrder struct {
	ID               *Ordering `json:"ID,omitempty"`
	Email            *Ordering `json:"email,omitempty"`
	Username         *Ordering `json:"username,omitempty"`
	Status           *Ordering `json:"status,omitempty"`
	RegistrationDate *Ordering `json:"registrationDate,omitempty"`
	Country          *Ordering `json:"country,omitempty"`
	Manager          *Ordering `json:"manager,omitempty"`
	CreatedAt        *Ordering `json:"createdAt,omitempty"`
	UpdatedAt        *Ordering `json:"updatedAt,omitempty"`
}

UserListOrder implements order for user list query

func (*UserListOrder) Order

func (ord *UserListOrder) Order() *user.ListOrder

Order converts local graphql model to order

type UserPayload

type UserPayload struct {
	// A unique identifier for the client performing the mutation.
	ClientMutationID string `json:"clientMutationID"`
	// User ID operation result
	UserID uint64 `json:"userID"`
	// User object accessor
	User *User `json:"user,omitempty"`
}

UserPayload wrapper to access of user oprtation results

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL