entities

package
v0.0.0-...-e5a474c Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthUserToGrpcMessage

func AuthUserToGrpcMessage(user *User) *authQueryService.User

func GroupListToGrpc

func GroupListToGrpc(groups *GroupsList) *queryService.SearchGroupRes

func GroupMembershipListToGrpc

func GroupMembershipListToGrpc(groupMemberships *GroupMembershipsList) *queryService.GetGroupMembershipRes

func GroupMembershipToGrpcMessage

func GroupMembershipToGrpcMessage(groupMembership *GroupMembership) *queryService.GroupMembership

func GroupToGrpcMessage

func GroupToGrpcMessage(group *Group) *queryService.Group

func MembershipToGrpcMessage

func MembershipToGrpcMessage(membership *Membership) *queryService.Membership

func UserListToGrpc

func UserListToGrpc(users *UsersList) *queryService.SearchRes

func UserMembershipListToGrpc

func UserMembershipListToGrpc(userMemberships *UserMembershipsList) *queryService.GetUserMembershipRes

func UserMembershipToGrpcMessage

func UserMembershipToGrpcMessage(userMembership *UserMembership) *queryService.UserMembership

func UserToGrpcMessage

func UserToGrpcMessage(user *User) *queryService.User

Types

type Blacklist

type Blacklist struct {
	ID          string    `json:"id" bson:"_id,omitempty"`
	AccessToken string    `json:"accessToken,omitempty" bson:"access_token,omitempty"`
	CreatedAt   time.Time `json:"createdAt,omitempty" bson:"created_at,omitempty"`
	UpdatedAt   time.Time `json:"updatedAt,omitempty" bson:"updated_at,omitempty"`
}

Blacklist is a root struct that is used to store the json encoded data for/from a mongodb blacklist doc.

func (*Blacklist) GetID

func (b *Blacklist) GetID() string

GetID returns the unique identifier of the Blacklist

type Group

type Group struct {
	ID          string    `json:"id" bson:"_id,omitempty"`
	Name        string    `json:"name,omitempty" bson:"email,omitempty" validate:"required,min=3,max=250"`
	Description string    `json:"description,omitempty" bson:"description,omitempty" validate:"required,min=3,max=500"`
	CreatorID   string    `json:"creatorID,omitempty" bson:"creator_id,omitempty" validate:"required"`
	Active      bool      `json:"active,omitempty" bson:"active,omitempty"`
	CreatedAt   time.Time `json:"createdAt,omitempty" bson:"created_at,omitempty"`
	UpdatedAt   time.Time `json:"updatedAt,omitempty" bson:"updated_at,omitempty"`
}

func (*Group) GetID

func (u *Group) GetID() string

GetID returns the unique identifier of the Group

type GroupMembership

type GroupMembership struct {
	ID           string                 `json:"id" bson:"_id,omitempty"`
	UserID       string                 `json:"userID,omitempty" bson:"user_id,omitempty" validate:"required,min=3,max=250"`
	GroupID      string                 `json:"groupID,omitempty" bson:"group_id,omitempty" validate:"required,min=3,max=500"`
	MembershipID string                 `json:"membershipID,omitempty" bson:"membership_id,omitempty" validate:"required,min=3,max=500"`
	Name         string                 `json:"name,omitempty" bson:"name,omitempty" validate:"required,min=3,max=500"`
	Description  string                 `json:"description,omitempty" bson:"description,omitempty" validate:"required,min=3,max=500"`
	Status       enums.MembershipStatus `json:"status,omitempty" bson:"status,omitempty" validate:"required"`
	Role         enums.Role             `json:"role,omitempty" bson:"role,omitempty"`
	Creator      bool                   `json:"creator,omitempty" bson:"creator,omitempty"`
	CreatedAt    time.Time              `json:"createdAt,omitempty" bson:"created_at,omitempty"`
	UpdatedAt    time.Time              `json:"updatedAt,omitempty" bson:"updated_at,omitempty"`
}

func (*GroupMembership) GetID

func (u *GroupMembership) GetID() string

GetID returns the unique identifier of the GroupMembership

type GroupMembershipsList

type GroupMembershipsList struct {
	TotalCount       int64              `json:"totalCount" bson:"total_count"`
	TotalPages       int64              `json:"totalPages" bson:"total_pages"`
	Page             int64              `json:"page" bson:"page"`
	Size             int64              `json:"size" bson:"size"`
	HasMore          bool               `json:"hasMore" bson:"has_more"`
	GroupMemberships []*GroupMembership `json:"groupMemberships" bson:"group_memberships"`
}

GroupMembershipsList response with pagination

func NewGroupMembershipListWithPagination

func NewGroupMembershipListWithPagination(memberships []*GroupMembership, count int64, pagination *utilities.Pagination) *GroupMembershipsList

type GroupsList

type GroupsList struct {
	TotalCount int64    `json:"totalCount" bson:"total_count"`
	TotalPages int64    `json:"totalPages" bson:"total_pages"`
	Page       int64    `json:"page" bson:"page"`
	Size       int64    `json:"size" bson:"size"`
	HasMore    bool     `json:"hasMore" bson:"has_more"`
	Groups     []*Group `json:"groups" bson:"groups"`
}

GroupsList response with pagination

func NewGroupListWithPagination

func NewGroupListWithPagination(groups []*Group, count int64, pagination *utilities.Pagination) *GroupsList

type Membership

type Membership struct {
	ID        string                 `json:"id" bson:"_id,omitempty"`
	UserID    string                 `json:"userID,omitempty" bson:"user_id,omitempty" validate:"required,min=3,max=250"`
	GroupID   string                 `json:"groupID,omitempty" bson:"group_id,omitempty" validate:"required,min=3,max=500"`
	Status    enums.MembershipStatus `json:"status,omitempty" bson:"status,omitempty" validate:"required"`
	Role      enums.Role             `json:"role,omitempty" bson:"role,omitempty"`
	CreatedAt time.Time              `json:"createdAt,omitempty" bson:"created_at,omitempty"`
	UpdatedAt time.Time              `json:"updatedAt,omitempty" bson:"updated_at,omitempty"`
}

func (*Membership) GetID

func (u *Membership) GetID() string

GetID returns the unique identifier of the Membership

type Model

type Model interface {
	GetID() string
}

type User

type User struct {
	ID        string    `json:"id" bson:"_id,omitempty"`
	Email     string    `json:"email,omitempty" bson:"email,omitempty" validate:"required,min=3,max=250"`
	Username  string    `json:"username,omitempty" bson:"username,omitempty" validate:"required,min=3,max=500"`
	Password  string    `json:"password,omitempty" bson:"password,omitempty" validate:"required"`
	Root      bool      `json:"root,omitempty" bson:"root,omitempty"`
	Active    bool      `json:"active,omitempty" bson:"active,omitempty"`
	CreatedAt time.Time `json:"createdAt,omitempty" bson:"created_at,omitempty"`
	UpdatedAt time.Time `json:"updatedAt,omitempty" bson:"updated_at,omitempty"`
}

func (*User) Authenticate

func (u *User) Authenticate(checkPassword string) error

Authenticate compares an input password with the hashed password stored in the User model

func (*User) GetID

func (u *User) GetID() string

GetID returns the unique identifier of the User

type UserMembership

type UserMembership struct {
	ID           string                 `json:"id" bson:"_id,omitempty"`
	GroupID      string                 `json:"groupID,omitempty" bson:"group_id,omitempty" validate:"required,min=3,max=500"`
	UserID       string                 `json:"userID,omitempty" bson:"user_id,omitempty" validate:"required,min=3,max=250"`
	MembershipID string                 `json:"membershipID,omitempty" bson:"membership_id,omitempty" validate:"required,min=3,max=500"`
	Email        string                 `json:"email,omitempty" bson:"email,omitempty" validate:"required,min=3,max=500"`
	Username     string                 `json:"username,omitempty" bson:"username,omitempty" validate:"required,min=3,max=500"`
	Status       enums.MembershipStatus `json:"status,omitempty" bson:"status,omitempty" validate:"required"`
	Role         enums.Role             `json:"role,omitempty" bson:"role,omitempty"`
	CreatedAt    time.Time              `json:"createdAt,omitempty" bson:"created_at,omitempty"`
	UpdatedAt    time.Time              `json:"updatedAt,omitempty" bson:"updated_at,omitempty"`
}

func (*UserMembership) GetID

func (u *UserMembership) GetID() string

GetID returns the unique identifier of the UserMembership

type UserMembershipsList

type UserMembershipsList struct {
	TotalCount      int64             `json:"totalCount" bson:"total_count"`
	TotalPages      int64             `json:"totalPages" bson:"total_pages"`
	Page            int64             `json:"page" bson:"page"`
	Size            int64             `json:"size" bson:"size"`
	HasMore         bool              `json:"hasMore" bson:"has_more"`
	UserMemberships []*UserMembership `json:"userMemberships" bson:"user_memberships"`
}

UserMembershipsList response with pagination

func NewUserMembershipListWithPagination

func NewUserMembershipListWithPagination(memberships []*UserMembership, count int64, pagination *utilities.Pagination) *UserMembershipsList

type UsersList

type UsersList struct {
	TotalCount int64   `json:"totalCount" bson:"totalCount"`
	TotalPages int64   `json:"totalPages" bson:"totalPages"`
	Page       int64   `json:"page" bson:"page"`
	Size       int64   `json:"size" bson:"size"`
	HasMore    bool    `json:"hasMore" bson:"hasMore"`
	Users      []*User `json:"users" bson:"users"`
}

UsersList response with pagination

func NewUserListWithPagination

func NewUserListWithPagination(users []*User, count int64, pagination *utilities.Pagination) *UsersList

Jump to

Keyboard shortcuts

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