model

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptAES added in v0.1.2

func DecryptAES(key string, secure string) (decoded string, err error)

func Encrypt added in v0.1.2

func Encrypt(message string, key string) (encoded string, err error)

func RemainOrDecrypt added in v0.1.2

func RemainOrDecrypt(data string, key string) (string, error)

func RemainOrEncrypt added in v0.1.2

func RemainOrEncrypt(data string, key string) (string, error)

Types

type Account

type Account struct {
	gorm.Model
	Uid     string
	Line    string
	Consent bool
}

func (*Account) ToAccountPublic

func (a *Account) ToAccountPublic(displayName string, profileImage string) AccountPublic

type AccountPlatform

type AccountPlatform struct {
	Line string `json:"line"`
}

type AccountPublic

type AccountPublic struct {
	Uid          string           `json:"uid"`
	DisplayName  string           `json:"displayName"`
	ProfileImage string           `json:"profileImage"`
	Platform     *AccountPlatform `json:"platform"`
	Consent      bool             `json:"consent"`
}

type Assignment

type Assignment struct {
	gorm.Model
	Name         string
	Author       string
	Description  string
	ReminderTime string
	DueDate      int
	TagID        int
	Tag          *Tag
}

func (*Assignment) AfterFind added in v0.1.2

func (a *Assignment) AfterFind(tx *gorm.DB) (err error)

func (*Assignment) BeforeSave added in v0.1.2

func (a *Assignment) BeforeSave(tx *gorm.DB) (err error)

func (*Assignment) ToAssignmentPublic

func (a *Assignment) ToAssignmentPublic() AssignmentPublic

type AssignmentPublic

type AssignmentPublic struct {
	ID           string     `json:"id"`
	Name         string     `json:"name"`
	Author       string     `json:"author"`
	Description  string     `json:"description,omitempty"`
	DueDate      int        `json:"dueDate"`
	Tag          *TagPublic `json:"tag"`
	ReminderTime []int      `json:"reminderTime"`
}

type AssignmentRequest

type AssignmentRequest struct {
	Name         string `json:"name" validate:"required"`
	Description  string `json:"description"`
	DueDate      int    `json:"dueDate"`
	TagId        string `json:"tagId"`
	ReminderTime []int  `json:"reminderTime,omitempty" validate:"max=3,omitempty"`
}

func (*AssignmentRequest) ToAssignment

func (ar *AssignmentRequest) ToAssignment(author string) Assignment

type BulkResponse

type BulkResponse[T any] struct {
	Count    int     `json:"count"`
	Previous *string `json:"previous"`
	Next     *string `json:"next"`
	Results  []T     `json:"results"`
}

type CheckCompromisedPasswordRequest

type CheckCompromisedPasswordRequest struct {
	HashedPassword string `json:"hashedPassword"`
}

type CreateTagRequest

type CreateTagRequest struct {
	Name         string   `json:"name" validate:"required"`
	Color        string   `json:"color"`
	ReminderTime []int    `json:"reminderTime,omitempty" validate:"omitempty,max=3"`
	Subscriber   []string `json:"subscriber"`
}

func (*CreateTagRequest) ToTag

func (ct *CreateTagRequest) ToTag(author string) Tag

type GetTokenRequest added in v0.2.0

type GetTokenRequest struct {
	Code        string `json:"code"`
	RedirectUri string `json:"redirect_uri"`
	Nonce       string `json:"nonce"`
}

type OAuthToken added in v0.2.0

type OAuthToken struct {
	AccessToken string `json:"access_token"`
	IDToken     string `json:"id_token"`
	Scope       string `json:"scope"`
	ExpiresIn   int    `json:"expires_in"`
	TokenType   string `json:"token_type"`
}

type Tag

type Tag struct {
	gorm.Model
	Name          string
	Author        string
	Color         string
	ReminderTime  string
	Subscriber    string
	SecretKeyTotp string
}

func (*Tag) AfterFind added in v0.1.2

func (t *Tag) AfterFind(tx *gorm.DB) (err error)

func (*Tag) BeforeSave added in v0.1.2

func (t *Tag) BeforeSave(tx *gorm.DB) (err error)

func (*Tag) ToTagPublic

func (t *Tag) ToTagPublic(maskSecretKey bool) TagPublic

type TagPublic

type TagPublic struct {
	ID            string   `json:"id"`
	Name          string   `json:"name"`
	Author        string   `json:"author"`
	Color         string   `json:"color"`
	ReminderTime  []int    `json:"reminderTime"`
	Subscriber    []string `json:"subscriber"`
	SecretKeyTotp string   `json:"secretKeyTotp,omitempty"`
}

type TokenResponse added in v0.2.0

type TokenResponse struct {
	Token string `json:"token"`
}

type UpdateAccountRequest added in v0.1.3

type UpdateAccountRequest struct {
	Consent bool `json:"consent"`
}

type UpdateAssignmentRequest

type UpdateAssignmentRequest struct {
	Name         *string `json:"name,omitempty"`
	Description  *string `json:"description,omitempty"`
	DueDate      *int    `json:"dueDate,omitempty"`
	TagId        *string `json:"tagId,omitempty"`
	ReminderTime *[]int  `json:"reminderTime,omitempty" validate:"max=3,omitempty"`
}

func (*UpdateAssignmentRequest) UpdateAssignment

func (ur *UpdateAssignmentRequest) UpdateAssignment(assignment *Assignment)

type UpdateTagRequest

type UpdateTagRequest struct {
	Name         *string   `json:"name,omitempty"`
	Color        *string   `json:"color,omitempty"`
	ReminderTime *[]int    `json:"reminderTime,omitempty" validate:"omitempty,max=3"`
	Subscriber   *[]string `json:"subscribe"`
}

func (*UpdateTagRequest) UpdateTag

func (utr *UpdateTagRequest) UpdateTag(tag *Tag)

Jump to

Keyboard shortcuts

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