mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-24 07:15:43 +00:00
add api upload documents daily checklist
This commit is contained in:
@@ -74,6 +74,7 @@ func (u *DailyChecklistController) GetAll(c *fiber.Ctx) error {
|
||||
Name: name,
|
||||
Status: status,
|
||||
Category: item.Category,
|
||||
RejectReason: item.RejectReason,
|
||||
Date: item.Date,
|
||||
Kandang: kandang,
|
||||
CreatedUser: nil,
|
||||
@@ -303,12 +304,22 @@ func (u *DailyChecklistController) GetOne(c *fiber.Ctx) error {
|
||||
return err
|
||||
}
|
||||
|
||||
documentDTOs := make([]dto.DailyChecklistDocumentDTO, len(detail.DocumentURLs))
|
||||
for i, doc := range detail.DocumentURLs {
|
||||
documentDTOs[i] = dto.DailyChecklistDocumentDTO{
|
||||
Id: doc.ID,
|
||||
Name: doc.Name,
|
||||
Size: doc.Size,
|
||||
URL: doc.URL,
|
||||
}
|
||||
}
|
||||
|
||||
return c.Status(fiber.StatusOK).
|
||||
JSON(response.Success{
|
||||
Code: fiber.StatusOK,
|
||||
Status: "success",
|
||||
Message: "Get dailyChecklist successfully",
|
||||
Data: dto.ToDailyChecklistDetailDTO(detail.Checklist, detail.Phases, detail.Tasks, detail.AssignedEmployees, detail.TotalActivities, detail.Progress),
|
||||
Data: dto.ToDailyChecklistDetailDTO(detail.Checklist, detail.Phases, detail.Tasks, detail.AssignedEmployees, detail.TotalActivities, detail.Progress, documentDTOs),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -342,6 +353,12 @@ func (u *DailyChecklistController) UpdateOne(c *fiber.Ctx) error {
|
||||
return fiber.NewError(fiber.StatusBadRequest, "Invalid Id")
|
||||
}
|
||||
|
||||
form, err := c.MultipartForm()
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, "Invalid multipart form")
|
||||
}
|
||||
req.Documents = form.File["documents"]
|
||||
|
||||
if err := c.BodyParser(req); err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, "Invalid request body")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user