Files
online-backend/internal/identity/user/dto.go
GuwandykA 0971158e98
Some checks failed
CI/CD / Vet, test, build (push) Has been cancelled
CI/CD / Docker image (push) Has been cancelled
CI/CD / Deploy binary to server (push) Has been cancelled
ch users <-> branches
2026-09-18 22:59:58 +05:00

82 lines
2.4 KiB
Go

package user
import "time"
type LocalizedText struct {
En string `json:"en"`
Ru string `json:"ru"`
Tm string `json:"tm"`
}
type StaffBranchDTO struct {
Id int64 `json:"id"`
UniqueCode string `json:"uniqueCode"`
Name LocalizedText `json:"name"`
}
type UserPermissionDTO struct {
Id int64 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
GuardName string `json:"guardName"`
Module string `json:"module"`
}
type UserDTO struct {
Id int64 `json:"id"`
Email string `json:"email"`
Name string `json:"name"`
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
Username string `json:"username"`
Phone string `json:"phone"`
Avatar string `json:"avatar"`
Role string `json:"role"`
RoleId *int64 `json:"roleId,omitempty"`
Active bool `json:"active"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Branches []StaffBranchDTO `json:"branches,omitempty"`
Permissions []UserPermissionDTO `json:"permissions,omitempty"`
}
type CreateUserDTO struct {
Email string `json:"email" binding:"required"`
Password string `json:"password" binding:"required"`
Name string `json:"name" binding:"required"`
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
Username string `json:"username" binding:"required"`
Phone string `json:"phone"`
Avatar string `json:"avatar"`
Role string `json:"role"`
Active *bool `json:"active"`
}
type UpdateUserDTO struct {
Email string `json:"email" binding:"required"`
Name string `json:"name" binding:"required"`
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
Username string `json:"username" binding:"required"`
Phone string `json:"phone"`
Avatar string `json:"avatar"`
Role string `json:"role"`
Active bool `json:"active"`
}
type ListFilter struct {
Search string
BranchIds []int64
Page int
Limit int
// AllRoles, when true, skips the role=user filter so admin/superadmin
// callers see every user regardless of role.
AllRoles bool
}
type ListUserDTO struct {
Count int64 `json:"count"`
Users []UserDTO `json:"users"`
}