api change user password

This commit is contained in:
Efril
2026-01-14 14:08:27 +07:00
parent 057cccfef9
commit c8ea680e05
11 changed files with 89 additions and 23 deletions
+10 -4
View File
@@ -3,11 +3,11 @@ package contract
import "time"
const (
SettingIncomingLetterPrefix = "INCOMING_LETTER_PREFIX"
SettingIncomingLetterSequence = "INCOMING_LETTER_SEQUENCE"
SettingIncomingLetterPrefix = "INCOMING_LETTER_PREFIX"
SettingIncomingLetterSequence = "INCOMING_LETTER_SEQUENCE"
SettingIncomingLetterDepartmentRecipients = "INCOMING_LETTER_DEPARTMENT_RECIPIENTS"
SettingOutgoingLetterPrefix = "OUTGOING_LETTER_PREFIX"
SettingOutgoingLetterSequence = "OUTGOING_LETTER_SEQUENCE"
SettingOutgoingLetterPrefix = "OUTGOING_LETTER_PREFIX"
SettingOutgoingLetterSequence = "OUTGOING_LETTER_SEQUENCE"
)
type ErrorResponse struct {
@@ -29,6 +29,12 @@ type SuccessResponse struct {
Data interface{} `json:"data,omitempty"`
}
type NewSuccessResponse struct {
Success bool `json:"success"`
Message string `json:"message"`
Data interface{} `json:"data,omitempty"`
}
type PaginationRequest struct {
Page int `json:"page" validate:"min=1"`
Limit int `json:"limit" validate:"min=1,max=100"`
+12 -8
View File
@@ -7,17 +7,17 @@ import (
)
type CreateUserRequest struct {
Name string `json:"name" validate:"required,min=1,max=255"`
Email string `json:"email" validate:"required,email"`
Password string `json:"password" validate:"required,min=6"`
RoleID *uuid.UUID `json:"role_id,omitempty" validate:"required"`
Name string `json:"name" validate:"required,min=1,max=255"`
Email string `json:"email" validate:"required,email"`
Password string `json:"password" validate:"required,min=6"`
RoleID *uuid.UUID `json:"role_id,omitempty" validate:"required"`
DepartmentIDs []uuid.UUID `json:"department_ids,omitempty"`
}
type UpdateUserRequest struct {
Name *string `json:"name,omitempty" validate:"omitempty,min=1,max=255"`
Email *string `json:"email,omitempty" validate:"omitempty,email"`
Role *uuid.UUID `json:"role,omitempty"`
Role *uuid.UUID `json:"role,omitempty"`
IsActive *bool `json:"is_active,omitempty"`
Permissions *map[string]interface{} `json:"permissions,omitempty"`
DepartmentIDs *[]uuid.UUID `json:"department_ids,omitempty"`
@@ -28,6 +28,10 @@ type ChangePasswordRequest struct {
NewPassword string `json:"new_password" validate:"required,min=6"`
}
type ChangeUserPasswordRequest struct {
NewPassword string `json:"new_password" validate:"required,min=6"`
}
type UpdateUserOutletRequest struct {
OutletID uuid.UUID `json:"outlet_id" validate:"required"`
}
@@ -105,9 +109,9 @@ type CreateDepartmentRequest struct {
}
type UpdateDepartmentRequest struct {
Name *string `json:"name,omitempty" validate:"omitempty,min=1,max=255"`
Code *string `json:"code,omitempty" validate:"omitempty,min=1,max=50"`
ParentID *uuid.UUID `json:"parent_id,omitempty"`
Name *string `json:"name,omitempty" validate:"omitempty,min=1,max=255"`
Code *string `json:"code,omitempty" validate:"omitempty,min=1,max=50"`
ParentID *uuid.UUID `json:"parent_id,omitempty"`
}
type GetDepartmentResponse struct {