Implement Feedback Management System with CRUD Operations and API Enhancements
- Introduced a new feedback management system, including the creation of feedback entities, services, and repositories. - Implemented CRUD operations for feedback, allowing users to submit likes and dislikes on tenders. - Developed administrative endpoints for listing and retrieving feedback with comprehensive filtering options. - Enhanced public API to allow users to view feedback related to tenders. - Updated Swagger documentation to reflect new feedback endpoints and their functionalities. - Removed obsolete configuration file `config.yaml` as part of the transition to a modular configuration system. - Ensured adherence to Clean Architecture principles throughout the implementation.
This commit is contained in:
@@ -731,6 +731,54 @@ definitions:
|
||||
is_verified:
|
||||
type: boolean
|
||||
type: object
|
||||
feedback.FeedbackListResponse:
|
||||
properties:
|
||||
feedback:
|
||||
items:
|
||||
$ref: '#/definitions/feedback.FeedbackResponse'
|
||||
type: array
|
||||
meta:
|
||||
$ref: '#/definitions/response.Meta'
|
||||
type: object
|
||||
feedback.FeedbackResponse:
|
||||
properties:
|
||||
company_id:
|
||||
type: string
|
||||
created_at:
|
||||
type: integer
|
||||
customer_id:
|
||||
type: string
|
||||
feedback_type:
|
||||
$ref: '#/definitions/feedback.FeedbackType'
|
||||
id:
|
||||
type: string
|
||||
tender:
|
||||
type: string
|
||||
updated_at:
|
||||
type: integer
|
||||
type: object
|
||||
feedback.FeedbackType:
|
||||
enum:
|
||||
- like
|
||||
- dislike
|
||||
type: string
|
||||
x-enum-varnames:
|
||||
- FeedbackTypeLike
|
||||
- FeedbackTypeDislike
|
||||
feedback.ToggleFeedbackForm:
|
||||
properties:
|
||||
feedback_type:
|
||||
allOf:
|
||||
- $ref: '#/definitions/feedback.FeedbackType'
|
||||
enum:
|
||||
- like
|
||||
- dislike
|
||||
tender_id:
|
||||
type: string
|
||||
required:
|
||||
- feedback_type
|
||||
- tender_id
|
||||
type: object
|
||||
main.HealthResponse:
|
||||
properties:
|
||||
service:
|
||||
@@ -3661,6 +3709,255 @@ paths:
|
||||
summary: Get customers by type
|
||||
tags:
|
||||
- Admin-Customers
|
||||
/admin/v1/feedback:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Retrieve paginated list of feedback with optional filtering by
|
||||
various criteria. This endpoint is for administrative use and provides comprehensive
|
||||
filtering options.
|
||||
parameters:
|
||||
- description: Filter by tender ID (MongoDB ObjectID format)
|
||||
in: query
|
||||
name: tender_id
|
||||
type: string
|
||||
- description: Filter by customer ID (MongoDB ObjectID format)
|
||||
in: query
|
||||
name: customer_id
|
||||
type: string
|
||||
- description: Filter by company ID (MongoDB ObjectID format)
|
||||
in: query
|
||||
name: company_id
|
||||
type: string
|
||||
- description: Filter by feedback type
|
||||
enum:
|
||||
- like
|
||||
- dislike
|
||||
in: query
|
||||
name: feedback_type
|
||||
type: string
|
||||
- description: Filter by creation date from (Unix timestamp in seconds)
|
||||
format: int64
|
||||
in: query
|
||||
name: date_from
|
||||
type: integer
|
||||
- description: Filter by creation date to (Unix timestamp in seconds)
|
||||
format: int64
|
||||
in: query
|
||||
name: date_to
|
||||
type: integer
|
||||
- description: 'Number of items per page (default: 20, max: 100)'
|
||||
in: query
|
||||
maximum: 100
|
||||
minimum: 1
|
||||
name: limit
|
||||
type: integer
|
||||
- description: 'Number of items to skip for pagination (default: 0)'
|
||||
in: query
|
||||
minimum: 0
|
||||
name: offset
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: Feedback list retrieved successfully
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.APIResponse'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/feedback.FeedbackListResponse'
|
||||
type: object
|
||||
"400":
|
||||
description: Bad request - Invalid query parameters
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.APIResponse'
|
||||
- properties:
|
||||
error:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
type: object
|
||||
"422":
|
||||
description: Validation error - Invalid filter criteria
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.APIResponse'
|
||||
- properties:
|
||||
error:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
type: object
|
||||
"500":
|
||||
description: Internal server error
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.APIResponse'
|
||||
- properties:
|
||||
error:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: List feedback with filters
|
||||
tags:
|
||||
- Admin-Feedback
|
||||
/admin/v1/feedback/{id}:
|
||||
delete:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Mark feedback as deleted without permanently removing it from the
|
||||
database. The feedback will be marked as deleted and hidden from normal queries
|
||||
but can be restored if needed.
|
||||
parameters:
|
||||
- description: Feedback ID (MongoDB ObjectID format)
|
||||
in: path
|
||||
maxLength: 24
|
||||
minLength: 24
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: Feedback soft deleted successfully
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.APIResponse'
|
||||
- properties:
|
||||
message:
|
||||
type: string
|
||||
type: object
|
||||
"400":
|
||||
description: Bad request - Invalid feedback ID format
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.APIResponse'
|
||||
- properties:
|
||||
error:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
type: object
|
||||
"401":
|
||||
description: Unauthorized - User not authenticated
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.APIResponse'
|
||||
- properties:
|
||||
error:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
type: object
|
||||
"403":
|
||||
description: Forbidden - User not authorized to delete this feedback
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.APIResponse'
|
||||
- properties:
|
||||
error:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
type: object
|
||||
"404":
|
||||
description: Not found - Feedback not found
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.APIResponse'
|
||||
- properties:
|
||||
error:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
type: object
|
||||
"500":
|
||||
description: Internal server error
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.APIResponse'
|
||||
- properties:
|
||||
error:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: Soft delete feedback
|
||||
tags:
|
||||
- Admin-Feedback
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Retrieve feedback details by its unique identifier with loaded
|
||||
tender, customer, and company information. This endpoint provides comprehensive
|
||||
feedback data including related entity details.
|
||||
parameters:
|
||||
- description: Feedback ID (MongoDB ObjectID format)
|
||||
in: path
|
||||
maxLength: 24
|
||||
minLength: 24
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: feedback retrieved successfully
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.APIResponse'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/feedback.FeedbackResponse'
|
||||
type: object
|
||||
"400":
|
||||
description: Bad request - Invalid feedback ID format
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.APIResponse'
|
||||
- properties:
|
||||
error:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
type: object
|
||||
"404":
|
||||
description: Feedback not found
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.APIResponse'
|
||||
- properties:
|
||||
error:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
type: object
|
||||
"500":
|
||||
description: Internal server error
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.APIResponse'
|
||||
- properties:
|
||||
error:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: Get feedback by ID
|
||||
tags:
|
||||
- Admin-Feedback
|
||||
/admin/v1/health:
|
||||
get:
|
||||
consumes:
|
||||
@@ -4452,6 +4749,245 @@ paths:
|
||||
summary: Get users by role
|
||||
tags:
|
||||
- Admin-Users
|
||||
/api/v1/feedback:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Retrieve paginated list of feedback with optional filtering by
|
||||
various criteria. This endpoint is for public use and filters results based
|
||||
on the authenticated user's company.
|
||||
parameters:
|
||||
- description: Filter by tender ID (MongoDB ObjectID format)
|
||||
in: query
|
||||
name: tender_id
|
||||
type: string
|
||||
- description: Filter by customer ID (MongoDB ObjectID format)
|
||||
in: query
|
||||
name: customer_id
|
||||
type: string
|
||||
- description: Filter by company ID (MongoDB ObjectID format)
|
||||
in: query
|
||||
name: company_id
|
||||
type: string
|
||||
- description: Filter by feedback type
|
||||
enum:
|
||||
- like
|
||||
- dislike
|
||||
in: query
|
||||
name: feedback_type
|
||||
type: string
|
||||
- description: Filter by creation date from (Unix timestamp in seconds)
|
||||
format: int64
|
||||
in: query
|
||||
minimum: 0
|
||||
name: date_from
|
||||
type: integer
|
||||
- description: Filter by creation date to (Unix timestamp in seconds)
|
||||
format: int64
|
||||
in: query
|
||||
minimum: 0
|
||||
name: date_to
|
||||
type: integer
|
||||
- description: 'Number of items per page (default: 20, max: 100)'
|
||||
in: query
|
||||
maximum: 100
|
||||
minimum: 1
|
||||
name: limit
|
||||
type: integer
|
||||
- description: 'Number of items to skip for pagination (default: 0)'
|
||||
in: query
|
||||
minimum: 0
|
||||
name: offset
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: Feedback list retrieved successfully
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.APIResponse'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/feedback.FeedbackListResponse'
|
||||
type: object
|
||||
"400":
|
||||
description: Bad request - Invalid query parameters or missing company association
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.APIResponse'
|
||||
- properties:
|
||||
error:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
type: object
|
||||
"422":
|
||||
description: Validation error - Invalid filter criteria
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.APIResponse'
|
||||
- properties:
|
||||
error:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
type: object
|
||||
"500":
|
||||
description: Internal server error
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.APIResponse'
|
||||
- properties:
|
||||
error:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: List feedback with filters
|
||||
tags:
|
||||
- Feedback
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Toggle between like and dislike for a tender, or create a like
|
||||
if no feedback exists. This endpoint allows users to express their preference
|
||||
for tenders and automatically handles the toggle logic.
|
||||
parameters:
|
||||
- description: Feedback toggle request containing tender ID
|
||||
in: body
|
||||
name: feedback
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/feedback.ToggleFeedbackForm'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: Feedback toggled successfully
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.APIResponse'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/feedback.FeedbackResponse'
|
||||
type: object
|
||||
"400":
|
||||
description: Bad request - Invalid input data or missing customer/company
|
||||
association
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.APIResponse'
|
||||
- properties:
|
||||
error:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
type: object
|
||||
"401":
|
||||
description: Unauthorized - User not authenticated
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.APIResponse'
|
||||
- properties:
|
||||
error:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
type: object
|
||||
"422":
|
||||
description: Validation error - Invalid request data format
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.APIResponse'
|
||||
- properties:
|
||||
error:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
type: object
|
||||
"500":
|
||||
description: Internal server error
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.APIResponse'
|
||||
- properties:
|
||||
error:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: Toggle feedback for a tender
|
||||
tags:
|
||||
- Feedback
|
||||
/api/v1/feedback/{id}:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Retrieve feedback details by its unique identifier. This endpoint
|
||||
provides basic feedback information for public users.
|
||||
parameters:
|
||||
- description: Feedback ID (MongoDB ObjectID format)
|
||||
in: path
|
||||
maxLength: 24
|
||||
minLength: 24
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: Feedback retrieved successfully
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.APIResponse'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/feedback.FeedbackResponse'
|
||||
type: object
|
||||
"400":
|
||||
description: Bad request - Invalid feedback ID format
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.APIResponse'
|
||||
- properties:
|
||||
error:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
type: object
|
||||
"404":
|
||||
description: Feedback not found
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.APIResponse'
|
||||
- properties:
|
||||
error:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
type: object
|
||||
"500":
|
||||
description: Internal server error
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/response.APIResponse'
|
||||
- properties:
|
||||
error:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: Get feedback by ID
|
||||
tags:
|
||||
- Feedback
|
||||
/api/v1/profile:
|
||||
get:
|
||||
consumes:
|
||||
@@ -4645,6 +5181,8 @@ paths:
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/response.APIResponse'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: Get public tenders
|
||||
tags:
|
||||
- Tenders
|
||||
@@ -4679,6 +5217,8 @@ paths:
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/response.APIResponse'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: Get public tender details
|
||||
tags:
|
||||
- Tenders
|
||||
@@ -4714,9 +5254,15 @@ tags:
|
||||
- description: Administrative scraping job management operations for TED XML data
|
||||
collection including job control, monitoring, and status tracking
|
||||
name: Admin-Scraping
|
||||
- description: Administrative feedback management operations for web panel including
|
||||
CRUD operations, search, statistics, and comprehensive filtering with pagination
|
||||
name: Admin-Feedback
|
||||
- description: Customer authentication and authorization operations for mobile application
|
||||
including login, logout, token refresh, and profile access
|
||||
name: Authorization
|
||||
- description: Public tender information access for mobile application including active
|
||||
tender listings and detailed tender information
|
||||
name: Tenders
|
||||
- description: Public feedback management operations for mobile application including
|
||||
like, dislike, and comment on tenders
|
||||
name: Feedback
|
||||
|
||||
Reference in New Issue
Block a user