package dto import ( "errors" ) const ( MESSAGE_FAILED_CREATE_CLIENT = "failed create client" MESSAGE_SUCCESS_CREATE_CLIENT = "success create client" MESSAGE_FAILED_GET_CLIENT = "failed get client" MESSAGE_SUCCESS_GET_CLIENT = "success get client" MESSAGE_FAILED_UPDATE_CLIENT = "failed update client" MESSAGE_FAILED_PROSES_REQUEST = "failed proses request" MESSAGE_SUCCESS_UPDATE_CLIENT = "success update client" MESSAGE_FAILED_DELETE_CLIENT = "failed delete client" MESSAGE_SUCCESS_DELETE_CLIENT = "success delete client" MESSAGE_FAILED_GET_DATA_FROM_BODY = "failed get data from body" MESSAGE_SUCCESS_ASSIGN_MENUS_TO_CLIENT = "success assign menus to client" MESSAGE_SUCCESS_REMOVE_MENUS_FROM_CLIENT = "success remove menus from client" MESSAGE_FAILED_ASSIGN_MENUS_TO_CLIENT = "failed assign menus to client" MESSAGE_FAILED_REMOVE_MENUS_FROM_CLIENT = "failed remove menus from client" ) var ( ErrCreateClient = errors.New("failed to create client") ErrGetClientById = errors.New("failed to get client by id") ErrUpdateClient = errors.New("failed to update client") ErrDeleteClient = errors.New("failed to delete client") ErrMenuIdsAndClientIdEmpty = errors.New("menuIds and clientId must not be empty") ) type ( ClientCreateRequest struct { Name string `json:"name" form:"name" binding:"required,min=2,max=100"` PIC string `json:"pic" form:"pic" binding:"omitempty,min=2,max=100"` Phone string `json:"phone" form:"phone" binding:"omitempty,min=6,max=20"` Email string `json:"email" form:"email" binding:"omitempty,email,max=100"` Address string `json:"address" form:"address" binding:"omitempty"` Logo string `form:"-"` // diisi manual dari file, tidak di-bind otomatis } ClientResponse struct { ID string `json:"id"` Name string `json:"name"` PIC string `json:"pic"` Phone string `json:"phone"` Email string `json:"email"` Address string `json:"address"` Logo string `json:"logo"` Menus []MenuResponse `json:"menus,omitempty"` } MenuResponse struct { ID string `json:"id"` Name string `json:"name"` } ClientUpdateRequest struct { Name *string `json:"name" form:"name" binding:"omitempty,min=2,max=100"` PIC *string `json:"pic" form:"pic" binding:"omitempty,min=2,max=100"` Phone *string `json:"phone" form:"phone" binding:"omitempty,min=6,max=20"` Email *string `json:"email" form:"email" binding:"omitempty,email,max=100"` Address *string `json:"address" form:"address" binding:"omitempty"` Logo *string `form:"-"` // jika update logo, isi manual dari file } AssignMenusToClientRequest struct { MenuIds []string `json:"menu_ids" form:"menu_ids" binding:"required,dive,required,uuid4"` } RemoveMenusFromClientRequest struct { MenuIds []string `json:"menu_ids" form:"menu_ids" binding:"required,dive,required,uuid4"` } ClientFilter struct { Name string PIC string Phone string Email string Address string PerPage int Page int } )