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