feat: update request informations items params
This commit is contained in:
parent
1c668976fa
commit
9cad73e43f
|
|
@ -6,6 +6,7 @@ type RequestForInformationItems struct {
|
|||
ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"`
|
||||
RequestForInformationId int `json:"request_for_information_id" gorm:"type:int4"`
|
||||
RequestedInfo string `json:"requested_info" gorm:"type:varchar"`
|
||||
DetailedInfo string `json:"detailed_info" gorm:"type:varchar"`
|
||||
Reason string `json:"reason" gorm:"type:varchar"`
|
||||
StatusId int `json:"status_id" gorm:"type:int4"`
|
||||
IsActive *bool `json:"is_active" gorm:"type:bool"`
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ func (_i *requestForInformationItemsController) All(c *fiber.Ctx) error {
|
|||
reqContext := request.RequestForInformationItemsQueryRequestContext{
|
||||
RequestForInformationId: c.Query("requestForInformationId"),
|
||||
RequestedInfo: c.Query("requestedInfo"),
|
||||
DetailedInfo: c.Query("detailedInfo"),
|
||||
Reason: c.Query("reason"),
|
||||
StatusId: c.Query("statusId"),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ func RequestForInformationItemsResponseMapper(requestForInformationItemsReq *ent
|
|||
ID: requestForInformationItemsReq.ID,
|
||||
RequestForInformationId: requestForInformationItemsReq.RequestForInformationId,
|
||||
RequestedInfo: requestForInformationItemsReq.RequestedInfo,
|
||||
DetailedInfo: requestForInformationItemsReq.DetailedInfo,
|
||||
Reason: requestForInformationItemsReq.Reason,
|
||||
StatusId: requestForInformationItemsReq.StatusId,
|
||||
IsActive: requestForInformationItemsReq.IsActive,
|
||||
|
|
|
|||
|
|
@ -45,6 +45,10 @@ func (_i *requestForInformationItemsRepository) GetAll(req request.RequestForInf
|
|||
requestedInfo := strings.ToLower(*req.RequestedInfo)
|
||||
query = query.Where("LOWER(requested_info) LIKE ?", "%"+strings.ToLower(requestedInfo)+"%")
|
||||
}
|
||||
if req.DetailedInfo != nil && *req.DetailedInfo != "" {
|
||||
detailedInfo := strings.ToLower(*req.DetailedInfo)
|
||||
query = query.Where("LOWER(detailed_info) LIKE ?", "%"+strings.ToLower(detailedInfo)+"%")
|
||||
}
|
||||
if req.Reason != nil && *req.Reason != "" {
|
||||
reason := strings.ToLower(*req.Reason)
|
||||
query = query.Where("LOWER(reason) LIKE ?", "%"+strings.ToLower(reason)+"%")
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ type RequestForInformationItemsGeneric interface {
|
|||
type RequestForInformationItemsQueryRequest struct {
|
||||
RequestForInformationId *int `json:"requestForInformationId"`
|
||||
RequestedInfo *string `json:"requestedInfo"`
|
||||
DetailedInfo *string `json:"detailedInfo"`
|
||||
Reason *string `json:"reason"`
|
||||
StatusId *int `json:"statusId"`
|
||||
Pagination *paginator.Pagination `json:"pagination"`
|
||||
|
|
@ -22,6 +23,7 @@ type RequestForInformationItemsQueryRequest struct {
|
|||
type RequestForInformationItemsCreateRequest struct {
|
||||
RequestForInformationId int `json:"requestForInformationId" validate:"required"`
|
||||
RequestedInfo string `json:"requestedInfo" validate:"required"`
|
||||
DetailedInfo string `json:"detailedInfo" validate:"required"`
|
||||
Reason string `json:"reason" validate:"required"`
|
||||
StatusId int `json:"statusId" validate:"required"`
|
||||
}
|
||||
|
|
@ -30,6 +32,7 @@ func (req RequestForInformationItemsCreateRequest) ToEntity() *entity.RequestFor
|
|||
return &entity.RequestForInformationItems{
|
||||
RequestForInformationId: req.RequestForInformationId,
|
||||
RequestedInfo: req.RequestedInfo,
|
||||
DetailedInfo: req.DetailedInfo,
|
||||
Reason: req.Reason,
|
||||
StatusId: req.StatusId,
|
||||
IsActive: func() *bool { b := true; return &b }(),
|
||||
|
|
@ -40,6 +43,7 @@ type RequestForInformationItemsUpdateRequest struct {
|
|||
ID uint `json:"id" validate:"required"`
|
||||
RequestForInformationId int `json:"requestForInformationId" validate:"required"`
|
||||
RequestedInfo string `json:"requestedInfo" validate:"required"`
|
||||
DetailedInfo string `json:"detailedInfo" validate:"required"`
|
||||
Reason string `json:"reason" validate:"required"`
|
||||
StatusId int `json:"statusId" validate:"required"`
|
||||
}
|
||||
|
|
@ -49,6 +53,7 @@ func (req RequestForInformationItemsUpdateRequest) ToEntity() *entity.RequestFor
|
|||
ID: req.ID,
|
||||
RequestForInformationId: req.RequestForInformationId,
|
||||
RequestedInfo: req.RequestedInfo,
|
||||
DetailedInfo: req.DetailedInfo,
|
||||
Reason: req.Reason,
|
||||
StatusId: req.StatusId,
|
||||
UpdatedAt: time.Now(),
|
||||
|
|
@ -58,6 +63,7 @@ func (req RequestForInformationItemsUpdateRequest) ToEntity() *entity.RequestFor
|
|||
type RequestForInformationItemsQueryRequestContext struct {
|
||||
RequestForInformationId string `json:"requestForInformationId"`
|
||||
RequestedInfo string `json:"requestedInfo"`
|
||||
DetailedInfo string `json:"detailedInfo"`
|
||||
Reason string `json:"reason"`
|
||||
StatusId string `json:"statusId"`
|
||||
}
|
||||
|
|
@ -74,6 +80,9 @@ func (req RequestForInformationItemsQueryRequestContext) ToParamRequest() Reques
|
|||
if requestedInfo := req.RequestedInfo; requestedInfo != "" {
|
||||
request.RequestedInfo = &requestedInfo
|
||||
}
|
||||
if detailedInfo := req.DetailedInfo; detailedInfo != "" {
|
||||
request.DetailedInfo = &detailedInfo
|
||||
}
|
||||
if reason := req.Reason; reason != "" {
|
||||
request.Reason = &reason
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ type RequestForInformationItemsResponse struct {
|
|||
ID uint `json:"id"`
|
||||
RequestForInformationId int `json:"requestForInformationId"`
|
||||
RequestedInfo string `json:"requestedInfo"`
|
||||
DetailedInfo string `json:"detailedInfo"`
|
||||
Reason string `json:"reason"`
|
||||
StatusId int `json:"statusId"`
|
||||
IsActive *bool `json:"isActive"`
|
||||
|
|
|
|||
|
|
@ -5314,6 +5314,11 @@ const docTemplate = `{
|
|||
],
|
||||
"summary": "Get all RequestForInformationItems",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"name": "detailedInfo",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"name": "reason",
|
||||
|
|
@ -9033,12 +9038,16 @@ const docTemplate = `{
|
|||
"request.RequestForInformationItemsCreateRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"detailedInfo",
|
||||
"reason",
|
||||
"requestForInformationId",
|
||||
"requestedInfo",
|
||||
"statusId"
|
||||
],
|
||||
"properties": {
|
||||
"detailedInfo": {
|
||||
"type": "string"
|
||||
},
|
||||
"reason": {
|
||||
"type": "string"
|
||||
},
|
||||
|
|
@ -9056,6 +9065,7 @@ const docTemplate = `{
|
|||
"request.RequestForInformationItemsUpdateRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"detailedInfo",
|
||||
"id",
|
||||
"reason",
|
||||
"requestForInformationId",
|
||||
|
|
@ -9063,6 +9073,9 @@ const docTemplate = `{
|
|||
"statusId"
|
||||
],
|
||||
"properties": {
|
||||
"detailedInfo": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -5303,6 +5303,11 @@
|
|||
],
|
||||
"summary": "Get all RequestForInformationItems",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"name": "detailedInfo",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"name": "reason",
|
||||
|
|
@ -9022,12 +9027,16 @@
|
|||
"request.RequestForInformationItemsCreateRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"detailedInfo",
|
||||
"reason",
|
||||
"requestForInformationId",
|
||||
"requestedInfo",
|
||||
"statusId"
|
||||
],
|
||||
"properties": {
|
||||
"detailedInfo": {
|
||||
"type": "string"
|
||||
},
|
||||
"reason": {
|
||||
"type": "string"
|
||||
},
|
||||
|
|
@ -9045,6 +9054,7 @@
|
|||
"request.RequestForInformationItemsUpdateRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"detailedInfo",
|
||||
"id",
|
||||
"reason",
|
||||
"requestForInformationId",
|
||||
|
|
@ -9052,6 +9062,9 @@
|
|||
"statusId"
|
||||
],
|
||||
"properties": {
|
||||
"detailedInfo": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -371,6 +371,8 @@ definitions:
|
|||
type: object
|
||||
request.RequestForInformationItemsCreateRequest:
|
||||
properties:
|
||||
detailedInfo:
|
||||
type: string
|
||||
reason:
|
||||
type: string
|
||||
requestForInformationId:
|
||||
|
|
@ -380,6 +382,7 @@ definitions:
|
|||
statusId:
|
||||
type: integer
|
||||
required:
|
||||
- detailedInfo
|
||||
- reason
|
||||
- requestForInformationId
|
||||
- requestedInfo
|
||||
|
|
@ -387,6 +390,8 @@ definitions:
|
|||
type: object
|
||||
request.RequestForInformationItemsUpdateRequest:
|
||||
properties:
|
||||
detailedInfo:
|
||||
type: string
|
||||
id:
|
||||
type: integer
|
||||
reason:
|
||||
|
|
@ -398,6 +403,7 @@ definitions:
|
|||
statusId:
|
||||
type: integer
|
||||
required:
|
||||
- detailedInfo
|
||||
- id
|
||||
- reason
|
||||
- requestForInformationId
|
||||
|
|
@ -4211,6 +4217,9 @@ paths:
|
|||
get:
|
||||
description: API for getting all RequestForInformationItems
|
||||
parameters:
|
||||
- in: query
|
||||
name: detailedInfo
|
||||
type: string
|
||||
- in: query
|
||||
name: reason
|
||||
type: string
|
||||
|
|
|
|||
Loading…
Reference in New Issue