entity

package
v0.0.0-...-acda5ee Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateEmailVerificationKey

func GenerateEmailVerificationKey() string

GenerateEmailVerificationKey returns a 64 chars key

Types

type BillingPayment

type BillingPayment struct {
	Amount   float64 `json:"amount"`
	Currency string  `json:"currency"`
	Date     string  `json:"date"`
}

type BillingPaymentInformation

type BillingPaymentInformation struct {
	PaymentMethod  string `json:"paymentMethod"`
	CardType       string `json:"cardType"`
	LastFourDigits string `json:"lastFourDigits"`
	ExpiryDate     string `json:"expiryDate"`
}

type BillingState

type BillingState struct {
	Status             enum.BillingStatus `json:"status"`
	PlanID             string             `json:"planID"`
	SubscriptionID     string             `json:"subscriptionID"`
	TrialEndsAt        *time.Time         `json:"trialEndsAt"`
	SubscriptionEndsAt *time.Time         `json:"subscriptionEndsAt"`
}

type BillingSubscription

type BillingSubscription struct {
	UpdateURL          string                    `json:"updateURL"`
	CancelURL          string                    `json:"cancelURL"`
	PaymentInformation BillingPaymentInformation `json:"paymentInformation"`
	LastPayment        BillingPayment            `json:"lastPayment"`
	NextPayment        BillingPayment            `json:"nextPayment"`
}

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 EmailVerification

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 GitHubConfig

type GitHubConfig struct {
	ID    int
	Token string
	Repo  string
	Owner string
}

OAuthConfig is the configuration of a custom OAuth provider

func (GitHubConfig) MarshalJSON

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

MarshalJSON returns the JSON encoding of OAuthConfig

type HttpHeaders

type HttpHeaders map[string]string

func (*HttpHeaders) Scan

func (h *HttpHeaders) Scan(src any) error

func (HttpHeaders) Value

func (h HttpHeaders) Value() (driver.Value, error)

type Notification

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

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

OAuthConfig is the configuration of a custom OAuth provider

func (OAuthConfig) MarshalJSON

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

MarshalJSON returns the JSON encoding of OAuthConfig

type OriginalPost

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

func (*OriginalPost) Url

func (i *OriginalPost) Url(baseURL string) string

type Post

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"`
	GitHub_ID     int             `json:"github_id"`
	GitHub        bool            `json:"github"`
	Issue_ID      int             `json:"issue_id"`
}

Post represents an post on a tenant board

func (*Post) CanBeVoted

func (i *Post) CanBeVoted() bool

CanBeVoted returns true if this post can have its vote changed

func (*Post) Url

func (i *Post) Url(baseURL string) string

type PostResponse

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 Tag

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             enum.TenantStatus `json:"status"`
	Locale             string            `json:"locale"`
	IsPrivate          bool              `json:"isPrivate"`
	LogoBlobKey        string            `json:"logoBlobKey"`
	CustomCSS          string            `json:"-"`
	IsEmailAuthAllowed bool              `json:"isEmailAuthAllowed"`
}

Tenant represents a tenant

func (*Tenant) IsDisabled

func (t *Tenant) IsDisabled() bool

type TenantContact

type TenantContact struct {
	Name      string `json:"name"`
	Email     string `json:"email"`
	Subdomain string `json:"subdomain"`
}

TenantContact is a reference to an administrator account

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

func (u *User) IsAdministrator() bool

IsAdministrator returns true if user is administrator

func (*User) IsCollaborator

func (u *User) IsCollaborator() bool

IsCollaborator returns true if user has special permissions

type UserProvider

type UserProvider struct {
	Name string
	UID  string
}

UserProvider represents the relationship between an User and an Authentication provide

type Vote

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

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

type Webhook

type Webhook struct {
	ID          int                `json:"id" db:"id"`
	Name        string             `json:"name" db:"name"`
	Type        enum.WebhookType   `json:"type" db:"type"`
	Status      enum.WebhookStatus `json:"status" db:"status"`
	Url         string             `json:"url" db:"url"`
	Content     string             `json:"content" db:"content"`
	HttpMethod  string             `json:"http_method" db:"http_method"`
	HttpHeaders HttpHeaders        `json:"http_headers" db:"http_headers"`
}

Webhook represents a webhook

Jump to

Keyboard shortcuts

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