Documentation ¶
Index ¶
- type APIStatus
- type ApiToken
- type ApiTokenInput
- type Audit
- type CreateProjectInput
- type DeleteApiTokenInput
- type Invitation
- type ListInvitationResponse
- type Member
- type MemberInput
- type MemberRole
- type MemberStat
- type Members
- type Owner
- type Project
- type ProjectInput
- type ProjectStats
- type ResourceDetails
- type RevokedToken
- type Role
- type State
- type UpdateUserState
- type User
- type UserDetailResponse
- type UserDetails
- type UserPassword
- type UserWithProject
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIStatus ¶
type APIStatus struct {
Status string `json:"status"`
}
APIStatus defines structure for APIroute status
type ApiToken ¶
type ApiToken struct { UserID string `bson:"user_id" json:"user_id"` Name string `bson:"name" json:"name"` Token string `bson:"token" json:"token"` ExpiresAt int64 `bson:"expires_at" json:"expires_at"` CreatedAt int64 `bson:"created_at" json:"created_at"` }
ApiToken struct for storing API tokens
type ApiTokenInput ¶
type ApiTokenInput struct { UserID string `json:"user_id"` Name string `json:"name"` DaysUntilExpiration int `json:"days_until_expiration"` }
ApiTokenInput struct for storing ApiTokenInput
type Audit ¶
type Audit struct { UpdatedAt int64 `bson:"updated_at" json:"updatedAt"` CreatedAt int64 `bson:"created_at" json:"createdAt"` CreatedBy UserDetailResponse `bson:"created_by" json:"createdBy"` UpdatedBy UserDetailResponse `bson:"updated_by" json:"updatedBy"` IsRemoved bool `bson:"is_removed" json:"isRemoved"` }
type CreateProjectInput ¶
type DeleteApiTokenInput ¶
type DeleteApiTokenInput struct {
Token string `json:"token"`
}
DeleteApiTokenInput struct for storing DeleteApiTokenInput
type Invitation ¶
type Invitation string
Invitation defines the type of the invitation that is sent by the Owner of the project to other users
const ( // PendingInvitation is the state when the Invitation is sent but not accepted PendingInvitation Invitation = "Pending" // AcceptedInvitation is the state when the Invitation is accepted AcceptedInvitation Invitation = "Accepted" // DeclinedInvitation is the state when the Invitation is rejected/declined DeclinedInvitation Invitation = "Declined" // ExitedProject is the state when the user has exited the project ExitedProject Invitation = "Exited" )
type ListInvitationResponse ¶
type ListInvitationResponse struct { ProjectID string `json:"projectID"` ProjectName string `json:"projectName"` ProjectOwner Member `json:"projectOwner"` InvitationRole MemberRole `json:"invitationRole"` }
type Member ¶
type Member struct { UserID string `bson:"user_id" json:"userID"` Username string `bson:"username" json:"username"` Email string `bson:"email" json:"email"` Name string `bson:"name" json:"name"` Role MemberRole `bson:"role" json:"role"` Invitation Invitation `bson:"invitation" json:"invitation"` JoinedAt int64 `bson:"joined_at" json:"joinedAt"` DeactivatedAt *int64 `bson:"deactivated_at,omitempty" json:"deactivatedAt,omitempty"` }
Member contains the required fields to be stored in the database for a member
func (*Member) GetMemberOutput ¶
GetMemberOutput takes a Member struct as input and returns the graphQL model equivalent
type MemberInput ¶
type MemberInput struct { ProjectID string `json:"projectID"` UserID string `json:"userID"` Role *MemberRole `json:"role"` }
type MemberRole ¶
type MemberRole string
MemberRole defines the project role a member has in the project
const ( RoleOwner MemberRole = "Owner" RoleEditor MemberRole = "Editor" RoleViewer MemberRole = "Viewer" )
type MemberStat ¶
type Project ¶
type Project struct { Audit `bson:",inline"` ID string `bson:"_id" json:"projectID"` Name string `bson:"name" json:"name"` Members []*Member `bson:"members" json:"members"` State *string `bson:"state" json:"state"` }
Project contains the required fields to be stored in the database for a project
func (*Project) GetMemberOutput ¶
GetMemberOutput takes a Project struct as input and returns the graphQL model equivalent for a members of the project
func (*Project) GetProjectOutput ¶
GetProjectOutput takes a Project struct as input and returns the graphQL model equivalent
type ProjectInput ¶
type ProjectStats ¶
type ProjectStats struct { Name string `bson:"name" json:"name"` ProjectID string `bson:"_id" json:"projectID"` Members *MemberStat `bson:"memberStat" json:"members"` }
type ResourceDetails ¶
type RevokedToken ¶
type RevokedToken struct { Token string `bson:"token"` ExpiresAt int64 `bson:"expires_at"` CreatedAt int64 `bson:"created_at"` }
RevokedToken struct for storing revoked tokens
type UpdateUserState ¶
type UpdateUserState struct { Username string `json:"username"` IsDeactivate *bool `json:"isDeactivate"` }
UpdateUserState defines structure to deactivate or reactivate user
type User ¶
type User struct { Audit `bson:",inline"` ID string `bson:"_id,omitempty" json:"userID"` Username string `bson:"username,omitempty" json:"username"` Password string `bson:"password,omitempty" json:"password,omitempty"` Email string `bson:"email,omitempty" json:"email,omitempty"` Name string `bson:"name,omitempty" json:"name,omitempty"` Role Role `bson:"role,omitempty" json:"role"` DeactivatedAt *int64 `bson:"deactivated_at,omitempty" json:"deactivatedAt,omitempty"` }
User contains the user information
func (User) GetUserWithProject ¶
func (user User) GetUserWithProject() *UserWithProject
func (*User) IsEmailValid ¶
IsEmailValid validates the email
func (*User) SanitizedUser ¶
SanitizedUser returns the user object without sensitive information
type UserDetailResponse ¶
type UserDetails ¶
type UserDetails struct { ID string `bson:"id,omitempty"` Email string `bson:"email,omitempty" json:"email,omitempty"` Name string `bson:"name,omitempty" json:"name,omitempty"` Password string `bson:"password,omitempty" json:"password,omitempty"` }
UserDetails is used to update user's personal details
type UserPassword ¶
type UserPassword struct { Username string `json:"username,omitempty"` OldPassword string `json:"oldPassword,omitempty"` NewPassword string `json:"newPassword,omitempty"` }
UserPassword defines structure for password related requests