feat (person): add check nick flow, and add nik validation
This commit is contained in:
@@ -3,11 +3,13 @@ package nurse
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
ee "simrs-vx/internal/domain/main-entities/employee"
|
||||
eu "simrs-vx/internal/domain/main-entities/unit"
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Employee_Id *uint `json:"employee_id"`
|
||||
IHS_Number *string `json:"ihs_number"`
|
||||
Unit_Id *uint16 `json:"unit_id"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
@@ -19,6 +21,7 @@ type ReadListDto struct {
|
||||
type FilterDto struct {
|
||||
Employee_Id *uint `json:"employee_id"`
|
||||
IHS_Number *string `json:"ihs_number"`
|
||||
Unit_Id *uint16 `json:"unit_id"`
|
||||
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"page_size"`
|
||||
@@ -50,6 +53,8 @@ type ResponseDto struct {
|
||||
Employee_Id *uint `json:"employee_id"`
|
||||
Employee *ee.Employee `json:"employee,omitempty"`
|
||||
IHS_Number *string `json:"ihs_number"`
|
||||
Unit_Id *uint16 `json:"unit_id"`
|
||||
Unit *eu.Unit `json:"unit,omitempty"`
|
||||
}
|
||||
|
||||
func (d Nurse) ToResponse() ResponseDto {
|
||||
@@ -57,6 +62,8 @@ func (d Nurse) ToResponse() ResponseDto {
|
||||
Employee_Id: d.Employee_Id,
|
||||
Employee: d.Employee,
|
||||
IHS_Number: d.IHS_Number,
|
||||
Unit_Id: d.Unit_Id,
|
||||
Unit: d.Unit,
|
||||
}
|
||||
resp.Main = d.Main
|
||||
return resp
|
||||
|
||||
@@ -19,7 +19,6 @@ type CreateDto struct {
|
||||
PersonRelatives []epr.UpdateDto `json:"personRelatives"`
|
||||
RegisteredAt *time.Time `json:"registeredAt"`
|
||||
Status_Code erc.ActiveStatusCode `json:"status_code"`
|
||||
Number *string `json:"number"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
|
||||
@@ -16,7 +16,7 @@ type CreateDto struct {
|
||||
PhoneNumber *string `json:"phoneNumber"`
|
||||
Education_Code *erp.EducationCode `json:"education_code"`
|
||||
Occupation_Code *erp.OcupationCode `json:"occupation_code"`
|
||||
Occupation_Name *string `json:"occupation_name"`
|
||||
Occupation_Name *string `json:"occupation_name" validate:"maxLength=50"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
|
||||
@@ -17,13 +17,13 @@ type CreateDto struct {
|
||||
BirthDate *time.Time `json:"birthDate,omitempty"`
|
||||
BirthRegency_Code *string `json:"birthRegency_code"`
|
||||
Gender_Code *erp.GenderCode `json:"gender_code"`
|
||||
ResidentIdentityNumber *string `json:"residentIdentityNumber"`
|
||||
ResidentIdentityNumber *string `json:"residentIdentityNumber" validate:"nik"`
|
||||
PassportNumber *string `json:"passportNumber"`
|
||||
DrivingLicenseNumber *string `json:"drivingLicenseNumber"`
|
||||
Religion_Code *erp.ReligionCode `json:"religion_code"`
|
||||
Education_Code *erp.EducationCode `json:"education_code"`
|
||||
Ocupation_Code *erp.OcupationCode `json:"occupation_code"`
|
||||
Ocupation_Name *string `json:"occupation_name"`
|
||||
Ocupation_Name *string `json:"occupation_name" validate:"maxLength=50"`
|
||||
Ethnic_Code *string `json:"ethnic_code"`
|
||||
Language_Code *string `json:"language_code"`
|
||||
}
|
||||
@@ -60,6 +60,8 @@ type ReadDetailDto struct {
|
||||
Id uint `json:"id"`
|
||||
Name *string `json:"name"`
|
||||
ResidentIdentityNumber *string `json:"residentIdentityNumber"`
|
||||
PassportNumber *string `json:"passportNumber"`
|
||||
DrivingLicenseNumber *string `json:"drivingLicenseNumber"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
|
||||
@@ -35,3 +35,10 @@ type Person struct {
|
||||
Language_Code *string `json:"language_code" gorm:"size:10"`
|
||||
Language *el.Language `json:"language,omitempty" gorm:"foreignKey:Language_Code;references:Code"`
|
||||
}
|
||||
|
||||
func (d Person) IsSameResidentIdentityNumber(input *string) bool {
|
||||
if input == nil {
|
||||
return false
|
||||
}
|
||||
return d.ResidentIdentityNumber == input
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user