model

package
v0.0.0-...-418667d Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessToken

type AccessToken struct {
	Token     string `json:"token"`
	ExpiresAt int64  `json:"expires_at"`
}

type AuthSession

type AuthSession struct {
	Id           string
	UserId       string
	RefreshToken string
	Revoked      bool
	UserAgent    string
	ExpiresAt    time.Time
}

type AuthSessionHandler

type AuthSessionHandler interface {
	Login() http.HandlerFunc
	Logout() http.HandlerFunc
	GetAccessToken() http.HandlerFunc
}

type AuthSessionRepository

type AuthSessionRepository interface {
	SaveSession(ctx context.Context, tx *sql.Tx, data *AuthSession)
	RevokeSession(ctx context.Context, tx *sql.Tx, userID string, userAgent string)
	CheckRefreshToken(ctx context.Context, tx *sql.Tx, userID string, userAgent string) (*AuthSession, error)
}

type AuthSessionService

type AuthSessionService interface {
	Login(ctx context.Context, request *LoginRequest, userAgent string) TokenResponse
	Logout(ctx context.Context, claims jwt.MapClaims, userAgent string)
	GetAccessToken(ctx context.Context, claims jwt.MapClaims, userAgent string) TokenResponse
}

type Client

type Client struct {
	ID      string
	Name    string
	Address string
	Phone   string
	Status  string
}

type ClientHandler

type ClientHandler interface {
	SaveClient() http.HandlerFunc
	UpdateClient() http.HandlerFunc
	GetClients() http.HandlerFunc
	GetClientsWithPagination() http.HandlerFunc
	GetClient() http.HandlerFunc
	DeleteClient() http.HandlerFunc
}

type ClientPIC

type ClientPIC struct {
	ID       int
	IDClient string
	Name     string
	Phone    string
	Email    string
	Address  string
}

type ClientPICResponse

type ClientPICResponse struct {
	ID      int    `json:"id"`
	Name    string `json:"name"`
	Phone   string `json:"phone"`
	Email   string `json:"email"`
	Address string `json:"address"`
}

type ClientRepository

type ClientRepository interface {
	SaveClient(ctx context.Context, tx *sql.Tx, data *Client)
	SaveClientPIC(ctx context.Context, tx *sql.Tx, data *[]ClientPIC)
	UpdateClient(ctx context.Context, tx *sql.Tx, data *Client)
	UpdateClientPIC(ctx context.Context, tx *sql.Tx, data *[]ClientPIC)
	GetClients(ctx context.Context, tx *sql.Tx) *[]Client
	GetClientsWithPagination(ctx context.Context, tx *sql.Tx, params *helper.PaginationParams) *[]Client
	GetClient(ctx context.Context, tx *sql.Tx, id string) (*Client, error)
	GetClientPIC(ctx context.Context, tx *sql.Tx, id string) *[]ClientPIC
	DeleteClient(ctx context.Context, tx *sql.Tx, id string)
	DeleteClientPIC(ctx context.Context, tx *sql.Tx, IDClient string, id []int)
}

type ClientResponse

type ClientResponse struct {
	ID        string              `json:"id"`
	Name      string              `json:"name"`
	Address   string              `json:"address"`
	Phone     string              `json:"phone"`
	Status    string              `json:"status"`
	ClientPic []ClientPICResponse `json:"client_pic"`
}

type ClientService

type ClientService interface {
	SaveClient(ctx context.Context, request *SaveRequestClient) ClientResponse
	UpdateClient(ctx context.Context, request *UpdateRequestClient) ClientResponse
	GetClients(ctx context.Context) []ClientResponse
	GetClientsWithPagination(ctx context.Context, params *helper.PaginationParams) []ClientResponse
	GetClient(ctx context.Context, id string) ClientResponse
	DeleteClient(ctx context.Context, id string)
}

type LoginRequest

type LoginRequest struct {
	Identifier string `validate:"required" json:"identifier"`
	Password   string `validate:"required" json:"password"`
}
type Navigation struct {
	Id       string            `json:"id"`
	Name     string            `json:"name"`
	Icon     string            `json:"icon"`
	PathUrl  string            `json:"path_url"`
	Children []NavigationChild `json:"children"`
}
type NavigationChild struct {
	Id       string            `json:"id"`
	Name     string            `json:"name"`
	PathUrl  string            `json:"path_url"`
	Children []NavigationChild `json:"children"`
}
type NavigationHandler interface {
	GetNavigation() http.HandlerFunc
}
type NavigationRepository interface {
	GetNavigation(group string) *[]Navigation
}
type NavigationService interface {
	GetNavigation(group string) *[]Navigation
}

type PIC

type PIC struct {
	ID     string
	Name   string
	Email  string
	Phone  string
	Status string
}

type PICHandler

type PICHandler interface {
	SavePIC() http.HandlerFunc
	UpdatePIC() http.HandlerFunc
	GetPICs() http.HandlerFunc
	GetPICsWithPagination() http.HandlerFunc
	GetPIC() http.HandlerFunc
	DeletePIC() http.HandlerFunc
}

type PICRepository

type PICRepository interface {
	SavePIC(ctx context.Context, tx *sql.Tx, data *PIC)
	UpdatePIC(ctx context.Context, tx *sql.Tx, data *PIC)
	GetPICs(ctx context.Context, tx *sql.Tx) *[]PIC
	GetPICsWithPagination(ctx context.Context, tx *sql.Tx, params *helper.PaginationParams) *[]PIC
	GetPIC(ctx context.Context, tx *sql.Tx, id string) (*PIC, error)
	DeletePIC(ctx context.Context, tx *sql.Tx, id string)
}

type PICResponse

type PICResponse struct {
	ID     string `json:"id"`
	Name   string `json:"name"`
	Phone  string `json:"phone"`
	Email  string `json:"email"`
	Status string `json:"status"`
}

type PICService

type PICService interface {
	SavePIC(ctx context.Context, request *SaveRequestPIC) PICResponse
	UpdatePIC(ctx context.Context, request *UpdateRequestPIC) PICResponse
	GetPICs(ctx context.Context) []PICResponse
	GetPICsWithPagination(ctx context.Context, params *helper.PaginationParams) []PICResponse
	GetPIC(ctx context.Context, id string) PICResponse
	DeletePIC(ctx context.Context, id string)
}

type Permission

type Permission struct {
	ID   int
	Name string
}

type PermissionHandler

type PermissionHandler interface{}

type PermissionRepository

type PermissionRepository interface {
	GetRolePermissionsByID(ctx context.Context, tx *sql.Tx, id int) *[]PermissionRole
}

type PermissionRole

type PermissionRole struct {
	IDRole       int
	IDPermission int
}

type PermissionRoleResponse

type PermissionRoleResponse struct {
	IDRole       int `json:"id_role"`
	IDPermission int `json:"id_permission"`
}

type PermissionService

type PermissionService interface {
	GetRolePermissionsByID(ctx context.Context, id int) []PermissionRoleResponse
}

type Project

type Project struct {
	ID                string
	IDClient          string
	IDClientPIC       int
	Description       string
	DescriptionClosed string
	ProjectType       string
	ProjectStatus     string
	Status            string
	Client            Client
	ClientPIC         ClientPIC
}

type ProjectDoc

type ProjectDoc struct {
	ID          int
	IDProject   string
	Description string
	FileName    string
}

type ProjectHandler

type ProjectHandler interface {
	SaveProject() http.HandlerFunc
	UpdateProject() http.HandlerFunc
	GetProjects() http.HandlerFunc
	GetProject() http.HandlerFunc
	SaveCloseProject() http.HandlerFunc
	UpdateCloseProject() http.HandlerFunc
	GetCloseProjects() http.HandlerFunc
	GetCloseProject() http.HandlerFunc
}

type ProjectRepository

type ProjectRepository interface {
	SaveProject(ctx context.Context, tx *sql.Tx, data *Project)
	UpdateProject(ctx context.Context, tx *sql.Tx, data *Project)
	GetProjects(ctx context.Context, tx *sql.Tx) *[]Project
	GetProject(ctx context.Context, tx *sql.Tx, id string) (*Project, error)
	SaveCloseProject(ctx context.Context, tx *sql.Tx, data *Project)
	SaveCloseProjectDoc(ctx context.Context, tx *sql.Tx, data *[]ProjectDoc)
	UpdateCloseProject(ctx context.Context, tx *sql.Tx, data *Project)
	UpdateCloseProjectDoc(ctx context.Context, tx *sql.Tx, data *[]ProjectDoc)
	GetCloseProjects(ctx context.Context, tx *sql.Tx) *[]Project
	GetCloseProject(ctx context.Context, tx *sql.Tx, id string) (*Project, error)
	GetCloseProjectDoc(ctx context.Context, tx *sql.Tx, id string) *[]ProjectDoc
	DeleteCloseProjectDoc(ctx context.Context, tx *sql.Tx, IDProject string, id []int)
}

type ProjectResponse

type ProjectResponse struct {
	ID            string `json:"id"`
	Description   string `json:"description"`
	ProjectType   string `json:"project_type"`
	ProjectStatus string `json:"project_status"`
	Status        string `json:"status"`
}

type ProjectService

type ProjectService interface {
	SaveProject(ctx context.Context, request *SaveRequestProject) ProjectResponse
	UpdateProject(ctx context.Context, request *UpdateRequestProject) ProjectResponse
	GetProjects(ctx context.Context) []ProjectResponse
	GetProject(ctx context.Context, id string) ProjectResponse
	SaveCloseProject(ctx context.Context)
	UpdateCloseProject(ctx context.Context)
	GetCloseProjects(ctx context.Context)
	GetCloseProject(ctx context.Context)
}

type RefreshToken

type RefreshToken struct {
	Token     string `json:"token"`
	ExpiresAt int64  `json:"expires_at"`
}

type Role

type Role struct {
	ID   int
	Name string
}

type RoleHandler

type RoleHandler interface{}

type RoleRepository

type RoleRepository interface {
	GetRoleByID(ctx context.Context, tx *sql.Tx, id string) (*Role, error)
}

type RoleResponse

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

type RoleService

type RoleService interface {
	GetRoleByID(ctx context.Context, id string) RoleResponse
}

type SaveRequestClient

type SaveRequestClient struct {
	Name      string                 `json:"name" validate:"required,min=1,max=50"`
	Address   string                 `json:"address" validate:"required,min=1,max=100"`
	Phone     string                 `json:"phone" validate:"required,min=11,max=13"`
	ClientPIC []SaveRequestClientPIC `json:"client_pic" validate:"required,minclientpic,dive"`
}

type SaveRequestClientPIC

type SaveRequestClientPIC struct {
	Name    string `json:"name" validate:"required,min=1,max=50"`
	Email   string `json:"email" validate:"required,email,min=1,max=50"`
	Phone   string `json:"phone" validate:"required,min=1,max=13"`
	Address string `json:"address" validate:"required,min=1,max=100"`
}

type SaveRequestPIC

type SaveRequestPIC struct {
	Name  string `json:"name" validate:"required,min=1,max=50"`
	Email string `json:"email" validate:"required,email,min=1,max=50"`
	Phone string `json:"phone" validate:"required,min=1,max=13"`
}

type SaveRequestProject

type SaveRequestProject struct {
	IDClient    string `json:"id_client" validate:"required,min=1,max=14"`
	IDClientPIC int    `json:"id_client_pic" validate:"required"`
	Description string `json:"description" validate:"required,min=1,max=250"`
	ProjectType string `json:"project_type" validate:"required,min=1,max=20"`
}

type SaveRequestProjectDoc

type SaveRequestProjectDoc struct {
	Description string `json:"description" validate:"required,min=1,max=250"`
	FileName    string `json:"file_name" validate:"required,min=1,max=20"`
}

type SaveRequestUser

type SaveRequestUser struct {
	Username             string `json:"username" validate:"required,min=1,max=50"`
	Email                string `json:"email" validate:"required,email,min=1,max=50"`
	Password             string `json:"password" validate:"required,min=1,max=50"`
	PasswordConfirmation string `json:"password_confirmation" validate:"required,eqfield=Password"`
	Name                 string `json:"name" validate:"required,min=1,max=50"`
	Phone                string `json:"phone" validate:"required,min=1,max=13"`
	IDRole               int    `json:"id_role" validate:"required"`
	IDMenuGroup          string `json:"id_menu_group"`
}

type TokenResponse

type TokenResponse struct {
	AccessToken  AccessToken  `json:"access_token"`
	RefreshToken RefreshToken `json:"refresh_token"`
}

type UpdateRequestClient

type UpdateRequestClient struct {
	ID        string                   `json:"id" validate:"required"`
	Name      string                   `json:"name" validate:"required,min=1,max=50"`
	Address   string                   `json:"address" validate:"required,min=1,max=100"`
	Phone     string                   `json:"phone" validate:"required,min=11,max=13"`
	ClientPIC []UpdateRequestClientPIC `json:"client_pic" validate:"required,minclientpic,dive"`
}

type UpdateRequestClientPIC

type UpdateRequestClientPIC struct {
	ID       int    `json:"id"`
	IDClient string `json:"id_client"`
	Name     string `json:"name" validate:"required,min=1,max=50"`
	Email    string `json:"email" validate:"required,email,min=1,max=50"`
	Phone    string `json:"phone" validate:"required,min=1,max=13"`
	Address  string `json:"address" validate:"required,min=1,max=100"`
}

type UpdateRequestPIC

type UpdateRequestPIC struct {
	ID    string `json:"id"`
	Name  string `json:"name" validate:"required,min=1,max=50"`
	Email string `json:"email" validate:"required,email,min=1,max=50"`
	Phone string `json:"phone" validate:"required,min=1,max=13"`
}

type UpdateRequestProject

type UpdateRequestProject struct {
	ID          string `json:"id" validate:"required"`
	IDClient    string `json:"id_client" validate:"required,min=1,max=14"`
	IDClientPIC int    `json:"id_client_pic" validate:"required"`
	Description string `json:"description" validate:"required,min=1,max=250"`
	ProjectType string `json:"project_type" validate:"required,min=1,max=20"`
}

type UpdateRequestUser

type UpdateRequestUser struct {
	Email string `json:"email" validate:"required,email,min=1,max=50"`
	Name  string `json:"name" validate:"required,min=1,max=50"`
	Phone string `json:"phone" validate:"required,min=1,max=13"`
}

type User

type User struct {
	ID           string
	Username     string
	Email        string
	Password     string
	Name         string
	Phone        string
	IDRole       int
	IDMenuGroup  string
	StatusActive bool
	Avatar       string
	UpdatedAt    string
	DeletedAt    string
}

type UserHandler

type UserHandler interface {
	GetUserByToken() http.HandlerFunc
	GetUserPhotoProfile() http.HandlerFunc
	SaveUser() http.HandlerFunc
	UpdateProfilePhotoUser() http.HandlerFunc
	UpdateUser() http.HandlerFunc
}

type UserRepository

type UserRepository interface {
	GetUserByEmail(ctx context.Context, tx *sql.Tx, email string) (*User, error)
	GetUserByUsername(ctx context.Context, tx *sql.Tx, username string) (*User, error)
	GetUserByID(ctx context.Context, tx *sql.Tx, id string) (*User, error)
	SaveUser(ctx context.Context, tx *sql.Tx, data *User)
	UpdateProfilePhotoUser(ctx context.Context, tx *sql.Tx, data *User)
	UpdateUser(ctx context.Context, tx *sql.Tx, data *User)
}

type UserResponse

type UserResponse struct {
	ID           string `json:"id"`
	Username     string `json:"username"`
	Password     string `json:"-"`
	Email        string `json:"email"`
	Name         string `json:"name"`
	Phone        string `json:"phone"`
	IDRole       int    `json:"id_role"`
	IDMenuGroup  string `json:"id_menu_group"`
	StatusActive bool   `json:"status_active"`
	Avatar       string `json:"avatar"`
}

type UserService

type UserService interface {
	GetUserByEmail(ctx context.Context, email string) UserResponse
	GetUserByUsername(ctx context.Context, username string) UserResponse
	GetUserByID(ctx context.Context, id string) UserResponse
	SaveUser(ctx context.Context, request *SaveRequestUser) UserResponse
	UpdateProfilePhotoUser(ctx context.Context, fileName string, claims jwt.MapClaims) UserResponse
	UpdateUser(ctx context.Context, request *UpdateRequestUser, claims jwt.MapClaims) UserResponse
}

Jump to

Keyboard shortcuts

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