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