utils

package
v0.0.0-...-6de2cf1 Latest Latest
Warning

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

Go to latest
Published: May 1, 2023 License: BSL-1.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Register = `` /* 131-byte string literal not displayed */

	Login = `
		SELECT password FROM users WHERE phone = $1
	`

	GetProgrammers = `
		SELECT * FROM users WHERE position = 'programmer'
	`

	GetProgrammer = `
		SELECT * FROM users WHERE id = $1
	`

	UpdatePassword = `
		UPDATE users SET password = $1 WHERE phone = $2
	`

	DeleteUser = `
		DELETE FROM users WHERE id = $1
	`

	GetPassword = `
		SELECT password FROM users WHERE id = $1
	`

	CreateProject = `
		INSERT INTO projects (name, status, teamlead_id, attachment) VALUES ($1, $2, $3, $4)
	`

	GetProjects = `
		SELECT * FROM projects
	`

	UpdateProjectStatus = `
		UPDATE projects SET status = $1 WHERE id = $2
	`

	DeleteProject = `
		DELETE FROM projects WHERE id = $1
	`

	GetProject = `
		SELECT * FROM projects WHERE id = $1
	`

	AddAttendance = `
		INSERT INTO attendance (type, user_id, date) VALUES ($1, $2, $3)
	`

	GetUserAttendance = `
		SELECT * FROM attendance WHERE user_id = $1 AND type = $2
	`

	CreateTask = `` /* 152-byte string literal not displayed */

	UpdateTaskStatus = `
		UPDATE tasks SET status = $1 WHERE id = $2
	`

	GetTasks = `
		SELECT * FROM tasks WHERE project_id = $1 AND programmer_id = $2
	`

	GetTask = `
		SELECT * FROM tasks WHERE id = $1
	`

	DeleteTask = `
		DELETE FROM tasks WHERE id = $1
	`

	StartTask = `
		UPDATE tasks SET started_at = $1 WHERE id = $2
	`

	FinishTask = `
		UPDATE tasks SET finished_at = $1 WHERE id = $2
	`

	WriteComment = `
		INSERT INTO comments (task_id, programmer_id, text) VALUES ($1, $2, $3) RETURNING id
	`

	GetComments = `
		SELECT * FROM comments WHERE task_id = $1
	`

	DeleteComment = `
		DELETE FROM comments WHERE id = $1
	`
)

Functions

func GeneratePasswordHash

func GeneratePasswordHash(pass string) ([]byte, error)

GeneratePasswordHash ...

func IsEnumValue

func IsEnumValue(enum []string, value string) bool

Types

type AddAttendanceRequestModel

type AddAttendanceRequestModel struct {
	Type      string `json:"type"`
	UserID    string `json:"user_id"`
	CreatedAt string `json:"created_at"`
}

type CreateTaskRequestModel

type CreateTaskRequestModel struct {
	Title        string `json:"title"`
	Description  string `json:"description"`
	StartAt      string `json:"start_at"`
	FinishAt     string `json:"finish_at"`
	ProjectID    int    `json:"project_id"`
	ProgrammerID string `json:"programmer_id"`
	Attachment   string `json:"attachment"`
}

type CreateTaskResponseModel

type CreateTaskResponseModel struct {
	ID int `json:"id"`
}

type DeleteCommentRequestModel

type DeleteCommentRequestModel struct {
	ID       int    `json:"id"`
	Phone    string `json:"phone"`
	Password string `json:"password"`
}

type DeleteProjectRequestModel

type DeleteProjectRequestModel struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

type DeleteTaskRequestModel

type DeleteTaskRequestModel struct {
	ID       int    `json:"id"`
	Phone    string `json:"phone"`
	Password string `json:"password"`
}

type DeleteUserRequestModel

type DeleteUserRequestModel struct {
	ID       string `json:"id"`
	Password string `json:"password"`
}

type GetCommentsRequestModel

type GetCommentsRequestModel struct {
	TaskID int `json:"task_id"`
}

type GetTasksRequestModel

type GetTasksRequestModel struct {
	ProjectID    int    `json:"project_id"`
	ProgrammerID string `json:"programmer_id"`
}

type GetUserAttendanceRequestModel

type GetUserAttendanceRequestModel struct {
	UserID string `json:"user_id"`
	Type   string `json:"type"`
}

type GetWithIDRequestModel

type GetWithIDRequestModel struct {
	ID int `json:"id"`
}

type LoginRequestModel

type LoginRequestModel struct {
	Phone    string `json:"phone"`
	Password string `json:"password"`
}

type LoginResponseModel

type LoginResponseModel struct {
	ID string `json:"id"`
}

type RegisterResponseModel

type RegisterResponseModel struct {
	ID           string `json:"id"`
	AccessToken  string `json:"access_token"`
	ExpiresIn    int64  `json:"expires_in"`
	RefreshToken string `json:"refresh_token"`
}

type StartOrFinishTaskRequestModel

type StartOrFinishTaskRequestModel struct {
	ID   int    `json:"id"`
	Date string `json:"date"`
	Type string `json:"type"`
}

type TokenMetadata

type TokenMetadata struct {
	UserID      uuid.UUID
	Credentials map[string]string
	Expires     int64
}

func ExtractTokenMetadata

func ExtractTokenMetadata(c *gin.Context) (*TokenMetadata, error)

ExtractTokenMetadata func to extract metadata from JWT.

type Tokens

type Tokens struct {
	Access    string
	AccExpire int64
	Refresh   string
}

Tokens struct to describe tokens object.

func GenerateNewTokens

func GenerateNewTokens(id string, credentials map[string]string) (*Tokens, error)

GenerateNewTokens func for generate a new Access & Refresh token

type UpdatePasswordRequestModel

type UpdatePasswordRequestModel struct {
	Phone       string `json:"phone"`
	OldPassword string `json:"old_password"`
	NewPassword string `json:"new_password"`
}

type UpdateProjectStatusRequestModel

type UpdateProjectStatusRequestModel struct {
	ID     int    `json:"id"`
	Status string `json:"status"`
}

type UpdateTaskStatusRequestModel

type UpdateTaskStatusRequestModel struct {
	ID     int    `json:"id"`
	Status string `json:"status"`
}

type WriteCommentRequestModel

type WriteCommentRequestModel struct {
	Text         string `json:"text"`
	ProgrammerID string `json:"programmer_id"`
	TaskID       int    `json:"task_id"`
}

type WriteCommentResponseModel

type WriteCommentResponseModel struct {
	ID int `json:"id"`
}

Jump to

Keyboard shortcuts

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