models

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateSecretKey added in v0.15.0

func GenerateSecretKey() string

GenerateSecretKey returns a 64 chars key

Types

type APIAuthorize added in v0.15.0

type APIAuthorize struct {
	APIKey string `json:"apiKey"`
}

APIAuthorize is used during API Authorize process

type AssignUnassignTag added in v0.8.0

type AssignUnassignTag struct {
	Slug   string `route:"slug"`
	Number int    `route:"number"`
}

AssignUnassignTag is used to assign or remove a tag to/from an post

type ChangeUserEmail added in v0.9.0

type ChangeUserEmail struct {
	Email           string `json:"email" format:"lower"`
	VerificationKey string
	Requestor       *User
}

ChangeUserEmail is the input model used to change current user's email

func (*ChangeUserEmail) GetEmail added in v0.9.0

func (e *ChangeUserEmail) GetEmail() string

GetEmail returns the email being verified

func (*ChangeUserEmail) GetKind added in v0.9.0

GetKind returns EmailVerificationKindSignIn

func (*ChangeUserEmail) GetName added in v0.9.0

func (e *ChangeUserEmail) GetName() string

GetName returns empty for this kind of process

func (*ChangeUserEmail) GetUser added in v0.9.0

func (e *ChangeUserEmail) GetUser() *User

GetUser returns the current user performing this action

type ChangeUserRole added in v0.7.0

type ChangeUserRole struct {
	Role   enum.Role `route:"role"`
	UserID int       `json:"userID"`
}

ChangeUserRole is the input model change role of an user

type Comment

type Comment struct {
	ID          int        `json:"id"`
	Content     string     `json:"content"`
	CreatedAt   time.Time  `json:"createdAt"`
	User        *User      `json:"user"`
	Attachments []string   `json:"attachments,omitempty"`
	EditedAt    *time.Time `json:"editedAt,omitempty"`
	EditedBy    *User      `json:"editedBy,omitempty"`
}

Comment represents an user comment on an post

type CompleteProfile added in v0.6.0

type CompleteProfile struct {
	Key   string `json:"key"`
	Name  string `json:"name"`
	Email string
}

CompleteProfile is the model used to complete user profile during email sign in

type CreateEditOAuthConfig added in v0.15.0

type CreateEditOAuthConfig struct {
	ID                int
	Provider          string       `json:"provider"`
	Status            int          `json:"status"`
	DisplayName       string       `json:"displayName"`
	ClientID          string       `json:"clientID"`
	ClientSecret      string       `json:"clientSecret"`
	AuthorizeURL      string       `json:"authorizeURL" format:"lower"`
	TokenURL          string       `json:"tokenURL" format:"lower"`
	Scope             string       `json:"scope"`
	ProfileURL        string       `json:"profileURL" format:"lower"`
	JSONUserIDPath    string       `json:"jsonUserIDPath"`
	JSONUserNamePath  string       `json:"jsonUserNamePath"`
	JSONUserEmailPath string       `json:"jsonUserEmailPath"`
}

CreateEditOAuthConfig is used to create/edit an OAuth Configuration

type CreateEditTag added in v0.8.0

type CreateEditTag struct {
	Slug     string `route:"slug"`
	Name     string `json:"name"`
	Color    string `json:"color" format:"upper"`
	IsPublic bool   `json:"isPublic"`
}

CreateEditTag is used to create a new tag or edit existing

type CreateTenant added in v0.5.0

type CreateTenant struct {
	Token           string `json:"token"`
	Name            string `json:"name"`
	Email           string `json:"email" format:"lower"`
	VerificationKey string
	TenantName      string `json:"tenantName"`
	LegalAgreement  bool   `json:"legalAgreement"`
	Subdomain       string `json:"subdomain" format:"lower"`
	UserClaims      *jwt.OAuthClaims
}

CreateTenant is the input model used to create a tenant

func (*CreateTenant) GetEmail added in v0.9.0

func (e *CreateTenant) GetEmail() string

GetEmail returns the email being verified

func (*CreateTenant) GetKind added in v0.9.0

GetKind returns EmailVerificationKindSignUp

func (*CreateTenant) GetName added in v0.9.0

func (e *CreateTenant) GetName() string

GetName returns the name of the email owner

func (*CreateTenant) GetUser added in v0.9.0

func (e *CreateTenant) GetUser() *User

GetUser returns the current user performing this action

type CreateUser added in v0.16.0

type CreateUser struct {
	Name      string `json:"name"`
	Email     string `json:"email"`
	Reference string `json:"reference"`
}

CreateUser is the input model to create a new user

type DeleteComment added in v0.16.0

type DeleteComment struct {
	PostNumber int `route:"number"`
	CommentID  int `route:"id"`
}

DeleteComment represents a request to delete an existing comment

type DeletePost added in v0.15.0

type DeletePost struct {
	Number int    `route:"number"`
	Text   string `json:"text"`
}

DeletePost represents a request to delete an existing post

type DeleteTag added in v0.8.0

type DeleteTag struct {
	Slug string `route:"slug"`
}

DeleteTag is used to delete an existing tag

type EditComment added in v0.11.0

type EditComment struct {
	PostNumber  int            `route:"number"`
	ID          int            `route:"id"`
	Content     string         `json:"content"`
	Attachments []*ImageUpload `json:"attachments"`
}

EditComment represents a request to edit existing comment

type EmailVerification added in v0.9.0

type EmailVerification struct {
	Email      string
	Name       string
	Key        string
	UserID     int
	Kind       enum.EmailVerificationKind
	CreatedAt  time.Time
	ExpiresAt  time.Time
	VerifiedAt *time.Time
}

EmailVerification is the model used by email verification process

type Event added in v0.16.0

type Event struct {
	ID        int       `json:"id"`
	ClientIP  string    `json:"clientIP"`
	Name      string    `json:"name"`
	CreatedAt time.Time `json:"createdAt"`
}

Event is used for tracking client audit events and actions

type ImageUpload added in v0.15.0

type ImageUpload struct {
	BlobKey string           `json:"bkey"`
	Upload  *ImageUploadData `json:"upload"`
	Remove  bool             `json:"remove"`
}

ImageUpload is the input model used to upload/remove an image

type ImageUploadData added in v0.15.0

type ImageUploadData struct {
	FileName    string `json:"fileName"`
	ContentType string `json:"contentType"`
	Content     []byte `json:"content"`
}

ImageUploadData is the input model used to upload a new logo

type InviteUsers added in v0.12.0

type InviteUsers struct {
	Subject    string   `json:"subject"`
	Message    string   `json:"message"`
	Recipients []string `json:"recipients" format:"lower"`
}

InviteUsers is used to invite new users into Fider

type NewComment added in v0.5.0

type NewComment struct {
	Number      int            `route:"number"`
	Content     string         `json:"content"`
	Attachments []*ImageUpload `json:"attachments"`
}

NewComment represents a new comment

type NewEmailVerification added in v0.9.0

type NewEmailVerification interface {
	GetEmail() string
	GetName() string
	GetUser() *User
	GetKind() enum.EmailVerificationKind
}

NewEmailVerification is used to register a new email verification process

type NewPost added in v0.15.0

type NewPost struct {
	Title       string         `json:"title"`
	Description string         `json:"description"`
	Attachments []*ImageUpload `json:"attachments"`
}

NewPost represents a new post

type Notification added in v0.10.0

type Notification struct {
	ID        int       `json:"id" db:"id"`
	Title     string    `json:"title" db:"title"`
	Link      string    `json:"link" db:"link"`
	Read      bool      `json:"read" db:"read"`
	CreatedAt time.Time `json:"createdAt" db:"created_at"`
}

Notification is the system generated notification entity

type OAuthConfig added in v0.15.0

type OAuthConfig struct {
	ID                int
	Provider          string
	DisplayName       string
	LogoBlobKey       string
	Status            int
	ClientID          string
	ClientSecret      string
	AuthorizeURL      string
	TokenURL          string
	ProfileURL        string
	Scope             string
	JSONUserIDPath    string
	JSONUserNamePath  string
	JSONUserEmailPath string
}

OAuthConfig is the configuration of a custom OAuth provider

func (OAuthConfig) MarshalJSON added in v0.15.0

func (o OAuthConfig) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of OAuthConfig

type OriginalPost added in v0.15.0

type OriginalPost struct {
	Number int             `json:"number"`
	Title  string          `json:"title"`
	Slug   string          `json:"slug"`
	Status enum.PostStatus `json:"status"`
}

OriginalPost holds details of the original post of a duplicate

type Post added in v0.15.0

type Post struct {
	ID            int             `json:"id"`
	Number        int             `json:"number"`
	Title         string          `json:"title"`
	Slug          string          `json:"slug"`
	Description   string          `json:"description"`
	CreatedAt     time.Time       `json:"createdAt"`
	User          *User           `json:"user"`
	HasVoted      bool            `json:"hasVoted"`
	VotesCount    int             `json:"votesCount"`
	CommentsCount int             `json:"commentsCount"`
	Status        enum.PostStatus `json:"status"`
	Response      *PostResponse   `json:"response,omitempty"`
	Tags          []string        `json:"tags"`
}

Post represents an post on a tenant board

func (*Post) CanBeVoted added in v0.16.0

func (i *Post) CanBeVoted() bool

CanBeVoted returns true if this post can have its vote changed

type PostResponse added in v0.15.0

type PostResponse struct {
	Text        string        `json:"text"`
	RespondedAt time.Time     `json:"respondedAt"`
	User        *User         `json:"user"`
	Original    *OriginalPost `json:"original"`
}

PostResponse is a staff response to a given post

type SetResponse added in v0.5.0

type SetResponse struct {
	Number         int             `route:"number"`
	Status         enum.PostStatus `json:"status"`
	Text           string          `json:"text"`
	OriginalNumber int             `json:"originalNumber"`
}

SetResponse represents the action to update an post response

type SignInByEmail added in v0.6.0

type SignInByEmail struct {
	Email           string `json:"email" format:"lower"`
	VerificationKey string
}

SignInByEmail is the input model when user request to sign in by email

func (*SignInByEmail) GetEmail added in v0.9.0

func (e *SignInByEmail) GetEmail() string

GetEmail returns the email being verified

func (*SignInByEmail) GetKind added in v0.9.0

GetKind returns EmailVerificationKindSignIn

func (*SignInByEmail) GetName added in v0.9.0

func (e *SignInByEmail) GetName() string

GetName returns empty for this kind of process

func (*SignInByEmail) GetUser added in v0.9.0

func (e *SignInByEmail) GetUser() *User

GetUser returns the current user performing this action

type SystemSettings added in v0.10.0

type SystemSettings struct {
	Mode            string
	BuildTime       string
	Version         string
	Environment     string
	GoogleAnalytics string
	Compiler        string
	Domain          string
	HasLegal        bool
}

SystemSettings is the system-wide settings

type Tag added in v0.8.0

type Tag struct {
	ID       int    `json:"id"`
	Name     string `json:"name"`
	Slug     string `json:"slug"`
	Color    string `json:"color"`
	IsPublic bool   `json:"isPublic"`
}

Tag represents a simple tag

type Tenant

type Tenant struct {
	ID             int    `json:"id"`
	Name           string `json:"name"`
	Subdomain      string `json:"subdomain"`
	Invitation     string `json:"invitation"`
	WelcomeMessage string `json:"welcomeMessage"`
	CNAME          string `json:"cname"`
	Status         int    `json:"status"`
	IsPrivate      bool   `json:"isPrivate"`
	LogoBlobKey    string `json:"logoBlobKey"`
	CustomCSS      string `json:"-"`
}

Tenant represents a tenant

type UpdatePost added in v0.15.0

type UpdatePost struct {
	Number      int            `route:"number"`
	Title       string         `json:"title"`
	Description string         `json:"description"`
	Attachments []*ImageUpload `json:"attachments"`
}

UpdatePost represents a request to edit an existing post

type UpdateTenantAdvancedSettings added in v0.13.0

type UpdateTenantAdvancedSettings struct {
	CustomCSS string `json:"customCSS"`
}

UpdateTenantAdvancedSettings is the input model used to update tenant advanced settings

type UpdateTenantPrivacy added in v0.12.0

type UpdateTenantPrivacy struct {
	IsPrivate bool `json:"isPrivate"`
}

UpdateTenantPrivacy is the input model used to update tenant privacy settings

type UpdateTenantSettings added in v0.5.0

type UpdateTenantSettings struct {
	Title          string       `json:"title"`
	Invitation     string       `json:"invitation"`
	WelcomeMessage string       `json:"welcomeMessage"`
	CNAME          string       `json:"cname" format:"lower"`
}

UpdateTenantSettings is the input model used to update tenant general settings

type UpdateUserSettings added in v0.6.0

type UpdateUserSettings struct {
	Name       string            `json:"name"`
	AvatarType enum.AvatarType   `json:"avatarType"`
	Avatar     *ImageUpload      `json:"avatar"`
	Settings   map[string]string `json:"settings"`
}

UpdateUserSettings is the model used to update user's settings

type Upload added in v0.13.0

type Upload struct {
	ContentType string `db:"content_type"`
	Size        int    `db:"size"`
	Content     []byte `db:"file"`
}

Upload represents a file that has been uploaded to Fider

type User

type User struct {
	ID            int             `json:"id"`
	Name          string          `json:"name"`
	Tenant        *Tenant         `json:"-"`
	Email         string          `json:"-"`
	Role          enum.Role       `json:"role"`
	Providers     []*UserProvider `json:"-"`
	AvatarBlobKey string          `json:"-"`
	AvatarType    enum.AvatarType `json:"-"`
	AvatarURL     string          `json:"avatarURL,omitempty"`
	Status        enum.UserStatus `json:"status"`
}

User represents an user inside our application

func (*User) HasProvider

func (u *User) HasProvider(provider string) bool

HasProvider returns true if current user has registered with given provider

func (*User) IsAdministrator added in v0.7.0

func (u *User) IsAdministrator() bool

IsAdministrator returns true if user is administrator

func (*User) IsCollaborator added in v0.7.0

func (u *User) IsCollaborator() bool

IsCollaborator returns true if user has special permissions

type UserInvitation added in v0.12.0

type UserInvitation struct {
	Email           string
	VerificationKey string
}

UserInvitation is the model used to register an invite sent to an user

func (*UserInvitation) GetEmail added in v0.12.0

func (e *UserInvitation) GetEmail() string

GetEmail returns the invited user's email

func (*UserInvitation) GetKind added in v0.12.0

GetKind returns EmailVerificationKindUserInvitation

func (*UserInvitation) GetName added in v0.12.0

func (e *UserInvitation) GetName() string

GetName returns empty for this kind of process

func (*UserInvitation) GetUser added in v0.12.0

func (e *UserInvitation) GetUser() *User

GetUser returns the current user performing this action

type UserProvider

type UserProvider struct {
	Name string
	UID  string
}

UserProvider represents the relationship between an User and an Authentication provide

type Vote added in v0.17.0

type Vote struct {
	User      *VoteUser `json:"user"`
	CreatedAt time.Time `json:"createdAt"`
}

Vote represents a vote given by a user on a post

type VoteUser added in v0.18.0

type VoteUser struct {
	ID        int    `json:"id"`
	Name      string `json:"name"`
	Email     string `json:"email,omitempty"`
	AvatarURL string `json:"avatarURL,omitempty"`
}

VoteUser represents a user that voted on a post

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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