SiLaju / docs /swagger.yaml
RyZ
refactor: cleaning magic variable and error
e02b818
basePath: /
definitions:
dto.AssignWorkerRequest:
properties:
admin_notes:
type: string
deadline:
type: string
report_id:
type: string
worker_id:
type: string
required:
- report_id
- worker_id
type: object
dto.AssignedWorkerResponse:
properties:
latitude:
type: number
longitude:
type: number
road_name:
type: string
status:
type: string
worker_name:
type: string
type: object
dto.AuthResponse:
properties:
token:
type: string
type: object
dto.GoogleAuthRequest:
properties:
idToken:
type: string
required:
- idToken
type: object
dto.GoogleAuthResponse:
properties:
token:
type: string
user:
$ref: '#/definitions/dto.GoogleUserDetails'
type: object
dto.GoogleUserDetails:
properties:
email:
type: string
fullname:
type: string
isNewUser:
type: boolean
type: object
dto.LoginRequest:
properties:
email:
type: string
password:
type: string
required:
- email
- password
type: object
dto.PaginatedReportsResponse:
properties:
limit:
type: integer
page:
type: integer
reports:
items:
$ref: '#/definitions/dto.UserReportResponse'
type: array
total_count:
type: integer
total_pages:
type: integer
type: object
dto.RegisterRequest:
properties:
email:
type: string
fullname:
type: string
password:
minLength: 6
type: string
username:
type: string
required:
- email
- fullname
- password
- username
type: object
dto.ReportLocationResponse:
properties:
destruct_class:
type: string
id:
type: string
latitude:
type: number
longitude:
type: number
total_score:
type: number
type: object
dto.ReportResponse:
properties:
after_image_url:
type: string
before_image_url:
type: string
description:
type: string
destruct_class:
type: string
id:
type: string
latitude:
type: number
location_score:
type: number
longitude:
type: number
road_name:
type: string
status:
type: string
total_score:
type: number
user_id:
type: string
type: object
dto.UserReportResponse:
properties:
admin_notes:
type: string
after_image_url:
type: string
before_image_url:
type: string
created_at:
type: string
deadline:
type: string
description:
type: string
destruct_class:
type: string
id:
type: string
latitude:
type: number
location_score:
type: number
longitude:
type: number
road_name:
type: string
status:
type: string
total_score:
type: number
type: object
dto.UserResponse:
properties:
email:
type: string
fullname:
type: string
id:
type: string
role:
type: string
username:
type: string
verified:
type: boolean
type: object
dto.VerifyOTPRequest:
properties:
email:
type: string
otp:
type: string
required:
- email
- otp
type: object
dto.VerifyReportRequest:
properties:
report_id:
type: string
required:
- report_id
type: object
host: localhost:8080
info:
contact:
email: support@dinacom.com
name: API Support
description: Backend service for Dinacom 11.0 Hackathon
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
termsOfService: http://swagger.io/terms/
title: Dinacom 11.0 Backend API
version: "1.0"
paths:
/api/admin/report/assign:
get:
description: Get all workers with assigned reports
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/dto.AssignedWorkerResponse'
type: array
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
security:
- BearerAuth: []
summary: Get Assigned Workers
tags:
- Admin
patch:
consumes:
- application/json
description: Admin assigns a worker to a report
parameters:
- description: Assign Worker Request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.AssignWorkerRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties:
type: string
type: object
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
security:
- BearerAuth: []
summary: Assign Worker to Report
tags:
- Admin
/api/admin/report/verify:
patch:
consumes:
- application/json
description: Admin verifies a report with status 'Finish by Worker' to 'finished'
parameters:
- description: Verify Report Request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.VerifyReportRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties:
type: string
type: object
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
security:
- BearerAuth: []
summary: Verify Report by Admin
tags:
- Admin
/api/auth/admin/login:
post:
consumes:
- application/json
description: Login for admins
parameters:
- description: Login Request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.LoginRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/dto.AuthResponse'
"401":
description: Unauthorized
schema:
additionalProperties:
type: string
type: object
summary: Login Admin
tags:
- Auth
/api/auth/admin/users:
get:
description: Get all users (Admin only)
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/dto.UserResponse'
type: array
"403":
description: Forbidden
schema:
additionalProperties:
type: string
type: object
security:
- BearerAuth: []
summary: Get All Users
tags:
- Admin
/api/auth/admin/workers:
get:
description: Get all workers (Admin only)
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/dto.UserResponse'
type: array
"403":
description: Forbidden
schema:
additionalProperties:
type: string
type: object
security:
- BearerAuth: []
summary: Get All Workers
tags:
- Admin
/api/auth/google:
post:
consumes:
- application/json
description: Authenticate with Google ID token and get JWT
parameters:
- description: Google Auth Request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.GoogleAuthRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/dto.GoogleAuthResponse'
"401":
description: Unauthorized
schema:
additionalProperties:
type: string
type: object
summary: Google Authentication
tags:
- Auth
/api/auth/me:
get:
description: Get current user's profile
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/dto.UserResponse'
"401":
description: Unauthorized
schema:
additionalProperties:
type: string
type: object
security:
- BearerAuth: []
summary: Get Profile
tags:
- Auth
/api/auth/user/login:
post:
consumes:
- application/json
description: Login for users
parameters:
- description: Login Request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.LoginRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/dto.AuthResponse'
"401":
description: Unauthorized
schema:
additionalProperties:
type: string
type: object
summary: Login User
tags:
- Auth
/api/auth/user/register:
post:
consumes:
- application/json
description: Register a new user with email verification via OTP
parameters:
- description: Register Request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.RegisterRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties:
type: string
type: object
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
summary: Register a new user
tags:
- Auth
/api/auth/user/verify-otp:
post:
consumes:
- application/json
description: Verify OTP to activate user account and get access token
parameters:
- description: Verify OTP Request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.VerifyOTPRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/dto.AuthResponse'
"401":
description: Unauthorized
schema:
additionalProperties:
type: string
type: object
summary: Verify OTP
tags:
- Auth
/api/auth/worker/login:
post:
consumes:
- application/json
description: Login for workers
parameters:
- description: Login Request
in: body
name: request
required: true
schema:
$ref: '#/definitions/dto.LoginRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/dto.AuthResponse'
"401":
description: Unauthorized
schema:
additionalProperties:
type: string
type: object
summary: Login Worker
tags:
- Auth
/api/get_report:
get:
description: Get all completed reports with non-good destruct class
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/dto.ReportLocationResponse'
type: array
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
summary: Get Reports
tags:
- Report
/api/user/report:
post:
consumes:
- multipart/form-data
description: Submit a new report with image and location data
parameters:
- description: Image file (JPG, PNG, JPEG, max 32MB)
in: formData
name: files
required: true
type: file
- default: '{"longitude": 106.816666, "latitude": -6.200000, "road_name": "Jalan
Sudirman", "description": "Lubang besar di tengah jalan"}'
description: JSON data
in: formData
name: json
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/dto.ReportResponse'
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
security:
- BearerAuth: []
summary: Create Report
tags:
- Report
/api/user/report/me:
get:
description: Get all reports created by the logged-in user with pagination
parameters:
- default: 1
description: Page number
in: query
name: page
type: integer
- default: 10
description: Items per page
in: query
name: limit
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/dto.PaginatedReportsResponse'
"401":
description: Unauthorized
schema:
additionalProperties:
type: string
type: object
security:
- BearerAuth: []
summary: Get User's Reports
tags:
- User
/api/worker/report:
patch:
consumes:
- multipart/form-data
description: Worker uploads after image and marks report as finished
parameters:
- description: After image file
in: formData
name: files
required: true
type: file
- default: '{"report_id": "uuid-here"}'
description: JSON data
in: formData
name: json
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties:
type: string
type: object
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
security:
- BearerAuth: []
summary: Finish Report by Worker
tags:
- Worker
/api/worker/report/assign/me:
get:
description: Get all reports assigned to the logged-in worker with pagination
parameters:
- default: 1
description: Page number
in: query
name: page
type: integer
- default: 10
description: Items per page
in: query
name: limit
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/dto.PaginatedReportsResponse'
"401":
description: Unauthorized
schema:
additionalProperties:
type: string
type: object
security:
- BearerAuth: []
summary: Get Worker's Assigned Reports
tags:
- Worker
/api/worker/report/history/me:
get:
description: Get worker's completed reports with pagination and status filter
parameters:
- default: 1
description: Page number
in: query
name: page
type: integer
- default: 10
description: Items per page
in: query
name: limit
type: integer
- default: false
description: 'True: finished, False: Finish by Worker'
in: query
name: verify_admin
type: boolean
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/dto.PaginatedReportsResponse'
"401":
description: Unauthorized
schema:
additionalProperties:
type: string
type: object
security:
- BearerAuth: []
summary: Get Worker's History
tags:
- Worker
securityDefinitions:
BearerAuth:
description: Type "Bearer" followed by a space and JWT token.
in: header
name: Authorization
type: apiKey
swagger: "2.0"