mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-23 06:45:43 +00:00
feat(BE-59,60,61): build stock transfer API with validation and audit log
- Implement CreateOne for stock transfer with multi-delivery and validation - Preload warehouse, location, and area relations in transfer response - Add audit log for transfer - Improve transaction handling and error management
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"math"
|
||||
"strconv"
|
||||
|
||||
@@ -72,11 +73,21 @@ func (u *TransferController) GetOne(c *fiber.Ctx) error {
|
||||
}
|
||||
|
||||
func (u *TransferController) CreateOne(c *fiber.Ctx) error {
|
||||
data := c.FormValue("data")
|
||||
|
||||
var req validation.TransferRequest
|
||||
if err := c.BodyParser(&req); err != nil {
|
||||
if err := json.Unmarshal([]byte(data), &req); err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, "Invalid request body")
|
||||
}
|
||||
|
||||
// ambil file
|
||||
form, err := c.MultipartForm()
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, "Invalid multipart form")
|
||||
}
|
||||
_ = form.File["documents"]
|
||||
// todo: tunggu ada aws baru proses
|
||||
|
||||
result, err := u.TransferService.CreateOne(c, &req)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user