feat: add DocumentType field to inventory issue entity and update related DTOs and service methods
Deploy Application / deploy (push) Successful in 20s Details

This commit is contained in:
Habib Fatkhul Rohman 2025-12-08 14:33:25 +07:00
parent 2eccaa33b3
commit a967158bac
4 changed files with 7 additions and 1 deletions

View File

@ -13,6 +13,7 @@ type TInventoryIssueEntity struct {
ID uuid.UUID `gorm:"primaryKey;type:uuid;default:uuid_generate_v4()" json:"id"`
DocumentNumber string `gorm:"type:varchar(100);" json:"document_number"`
DocumentDate time.Time `gorm:"type:timestamp;" json:"document_date"`
DocumentType string `gorm:"type:varchar(50);" json:"document_type"`
DueDate time.Time `gorm:"type:timestamp;" json:"due_date"`
Status string `gorm:"type:varchar(50);default:'draft'" json:"status"`

View File

@ -29,6 +29,7 @@ const (
type InventoryIssueCreateRequest struct {
DocumentDate string `json:"document_date"`
DocumentType string `json:"document_type"`
DueDate string `json:"due_date"`
IssuerBy string `json:"issuer_by"`
InvRequestID string `json:"inv_request_id"`
@ -49,6 +50,7 @@ type InventoryIssueLineCreateRequest struct {
}
type InventoryIssueUpdateRequest struct {
DocumentType string `json:"document_type"`
DocumentDate string `json:"document_date"`
DueDate string `json:"due_date"`
Status string `json:"status"`
@ -68,6 +70,7 @@ type InventoryIssueLineUpdateRequest struct {
type InventoryIssueResponse struct {
ID string `json:"id"`
DocumentNumber string `json:"document_number"`
DocumentType string `json:"document_type"`
DocumentDate string `json:"document_date"`
DueDate string `json:"due_date"`
Status string `json:"status"`
@ -177,6 +180,7 @@ func ToInventoryIssueResponse(e entities.TInventoryIssueEntity) InventoryIssueRe
return InventoryIssueResponse{
ID: e.ID.String(),
DocumentNumber: e.DocumentNumber,
DocumentType: e.DocumentType,
DocumentDate: utils.DateTimeToString(e.DocumentDate),
DueDate: utils.DateTimeToString(e.DueDate),
Status: e.Status,

View File

@ -82,6 +82,7 @@ func (s *inventoryIssueService) Create(ctx context.Context, req dtodomain.Invent
}
issue := entities.TInventoryIssueEntity{
DocumentNumber: docNum,
DocumentType: req.DocumentType,
DocumentDate: utils.StringToDateTime(req.DocumentDate),
DueDate: utils.StringToDateTime(req.DueDate),
IssuerBy: issuerUUID,
@ -185,6 +186,7 @@ func (s *inventoryIssueService) Update(ctx context.Context, req dtodomain.Invent
before := issue
issue.DocumentDate = utils.StringToDateTime(req.DocumentDate)
issue.DocumentType = req.DocumentType
issue.DueDate = utils.StringToDateTime(req.DueDate)
issue.Status = req.Status
issue.FullAuditTrail = utils.FillAuditTrail(ctx, constants.UPDATE)

View File

@ -533,7 +533,6 @@ func (s *userService) Verify(ctx context.Context, req dto.UserLoginRequest) (aut
isValid := utils.CheckPasswordHash(req.Password, user.Password)
if !isValid {
fmt.Println("Password validation error:", err)
return authDto.TokenResponse{}, dto.ErrUserNotFound
}
roles := append([]entities.M_Role{}, user.Roles...)