786 lines
18 KiB
YAML
786 lines
18 KiB
YAML
basePath: /
|
||
definitions:
|
||
api.CreateNewsEventsReq:
|
||
properties:
|
||
description:
|
||
type: string
|
||
source:
|
||
type: string
|
||
submitted_by:
|
||
type: integer
|
||
title:
|
||
type: string
|
||
url:
|
||
type: string
|
||
required:
|
||
- submitted_by
|
||
- title
|
||
- url
|
||
type: object
|
||
api.UpdateUserRequest:
|
||
properties:
|
||
about:
|
||
type: string
|
||
social_media: {}
|
||
website:
|
||
type: string
|
||
type: object
|
||
api.createReviewReq:
|
||
properties:
|
||
comments:
|
||
type: string
|
||
is_from_critic:
|
||
type: boolean
|
||
is_hided:
|
||
type: boolean
|
||
location_id:
|
||
type: integer
|
||
score:
|
||
maximum: 100
|
||
type: integer
|
||
submitted_by:
|
||
type: integer
|
||
title:
|
||
type: string
|
||
required:
|
||
- comments
|
||
- location_id
|
||
- submitted_by
|
||
type: object
|
||
api.createUserRequest:
|
||
properties:
|
||
password:
|
||
minLength: 7
|
||
type: string
|
||
username:
|
||
type: string
|
||
required:
|
||
- password
|
||
- username
|
||
type: object
|
||
host: localhost:8888
|
||
info:
|
||
contact: {}
|
||
description: REST API for Hiling — a location review and discovery platform.
|
||
title: Hiling API
|
||
version: "1.0"
|
||
paths:
|
||
/images/location:
|
||
get:
|
||
parameters:
|
||
- description: Location ID
|
||
in: query
|
||
name: location_id
|
||
required: true
|
||
type: integer
|
||
- description: Page (min 1)
|
||
in: query
|
||
name: page
|
||
required: true
|
||
type: integer
|
||
- description: Page size (min 5)
|
||
in: query
|
||
name: page_size
|
||
required: true
|
||
type: integer
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
"400":
|
||
description: Bad Request
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
summary: Get all images for a location
|
||
tags:
|
||
- images
|
||
/location/{location_id}:
|
||
get:
|
||
parameters:
|
||
- description: Location ID
|
||
in: path
|
||
name: location_id
|
||
required: true
|
||
type: integer
|
||
- description: 'Review type: ''user'', ''critics'', or both (default)'
|
||
in: query
|
||
name: review
|
||
type: string
|
||
- description: Page (default 1)
|
||
in: query
|
||
name: page
|
||
type: integer
|
||
- description: Page size (default 5)
|
||
in: query
|
||
name: page_size
|
||
type: integer
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
"404":
|
||
description: Not Found
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
summary: Get location detail
|
||
tags:
|
||
- locations
|
||
/location/{location_id}/review/{review_id}:
|
||
get:
|
||
parameters:
|
||
- description: Location ID
|
||
in: path
|
||
name: location_id
|
||
required: true
|
||
type: integer
|
||
- description: Review ID
|
||
in: path
|
||
name: review_id
|
||
required: true
|
||
type: integer
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
"404":
|
||
description: Not Found
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
summary: Get a single review
|
||
tags:
|
||
- reviews
|
||
/location/reviews:
|
||
get:
|
||
parameters:
|
||
- description: Location ID
|
||
in: query
|
||
name: location_id
|
||
required: true
|
||
type: integer
|
||
- description: Page (min 1)
|
||
in: query
|
||
name: page
|
||
required: true
|
||
type: integer
|
||
- description: Page size
|
||
in: query
|
||
name: page_size
|
||
required: true
|
||
type: integer
|
||
- description: 'Review type: 1=critics, 2=users, 0=all'
|
||
in: query
|
||
name: type
|
||
required: true
|
||
type: integer
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
"400":
|
||
description: Bad Request
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
summary: List location reviews
|
||
tags:
|
||
- locations
|
||
/location/tags/{location_id}:
|
||
get:
|
||
parameters:
|
||
- description: Location ID
|
||
in: path
|
||
name: location_id
|
||
required: true
|
||
type: integer
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
items:
|
||
additionalProperties: true
|
||
type: object
|
||
type: array
|
||
"400":
|
||
description: Bad Request
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
summary: Get tags for a location
|
||
tags:
|
||
- locations
|
||
/locations:
|
||
get:
|
||
parameters:
|
||
- description: Page number (min 1)
|
||
in: query
|
||
name: page
|
||
required: true
|
||
type: integer
|
||
- description: Page size (min 5)
|
||
in: query
|
||
name: page_size
|
||
required: true
|
||
type: integer
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
items:
|
||
additionalProperties: true
|
||
type: object
|
||
type: array
|
||
"400":
|
||
description: Bad Request
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
summary: List locations
|
||
tags:
|
||
- locations
|
||
post:
|
||
consumes:
|
||
- multipart/form-data
|
||
parameters:
|
||
- description: Address
|
||
in: formData
|
||
name: address
|
||
required: true
|
||
type: string
|
||
- description: Name
|
||
in: formData
|
||
name: name
|
||
required: true
|
||
type: string
|
||
- description: Submitted by user ID
|
||
in: formData
|
||
name: submitted_by
|
||
required: true
|
||
type: integer
|
||
- description: Regency ID
|
||
in: formData
|
||
name: regency_id
|
||
required: true
|
||
type: integer
|
||
- description: Location type
|
||
in: formData
|
||
name: location_type
|
||
required: true
|
||
type: string
|
||
- description: Amenities (comma-separated)
|
||
in: formData
|
||
name: amenities
|
||
type: string
|
||
- description: Google Maps link
|
||
in: formData
|
||
name: google_maps_link
|
||
type: string
|
||
- description: Thumbnail image
|
||
in: formData
|
||
name: thumbnail
|
||
type: file
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
"400":
|
||
description: Bad Request
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
summary: Create a location
|
||
tags:
|
||
- locations
|
||
/locations/recent:
|
||
get:
|
||
parameters:
|
||
- description: Number of results (min 1)
|
||
in: query
|
||
name: page_size
|
||
required: true
|
||
type: integer
|
||
- description: Filter by location type
|
||
in: query
|
||
name: location_type
|
||
type: string
|
||
- description: Filter by region
|
||
in: query
|
||
name: regions
|
||
type: string
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
items:
|
||
additionalProperties: true
|
||
type: object
|
||
type: array
|
||
"400":
|
||
description: Bad Request
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
summary: Recent locations with ratings
|
||
tags:
|
||
- locations
|
||
/locations/search:
|
||
get:
|
||
parameters:
|
||
- description: Search query
|
||
in: query
|
||
name: name
|
||
type: string
|
||
- description: Meilisearch filter expression
|
||
in: query
|
||
name: filter
|
||
type: string
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
items:
|
||
additionalProperties: true
|
||
type: object
|
||
type: array
|
||
"500":
|
||
description: Internal Server Error
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
summary: Search locations
|
||
tags:
|
||
- locations
|
||
/locations/top-ratings:
|
||
get:
|
||
parameters:
|
||
- description: Page number (min 1)
|
||
in: query
|
||
name: page
|
||
required: true
|
||
type: integer
|
||
- description: Page size (min 5)
|
||
in: query
|
||
name: page_size
|
||
required: true
|
||
type: integer
|
||
- description: 'Sort: 1=overall, 2=critics, 3=users'
|
||
in: query
|
||
name: order_by
|
||
type: integer
|
||
- description: Region type filter (0–7)
|
||
in: query
|
||
name: region_type
|
||
type: integer
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
items:
|
||
additionalProperties: true
|
||
type: object
|
||
type: array
|
||
"400":
|
||
description: Bad Request
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
summary: Top-rated locations
|
||
tags:
|
||
- locations
|
||
/news-events:
|
||
get:
|
||
parameters:
|
||
- description: Page (min 1)
|
||
in: query
|
||
name: page
|
||
required: true
|
||
type: integer
|
||
- description: Page size (min 5)
|
||
in: query
|
||
name: page_size
|
||
required: true
|
||
type: integer
|
||
- description: 1 = only approved items
|
||
in: query
|
||
name: is_with_approval
|
||
type: integer
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
items:
|
||
additionalProperties: true
|
||
type: object
|
||
type: array
|
||
"400":
|
||
description: Bad Request
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
summary: List news and events
|
||
tags:
|
||
- news
|
||
post:
|
||
consumes:
|
||
- application/json
|
||
parameters:
|
||
- description: News/event payload
|
||
in: body
|
||
name: body
|
||
required: true
|
||
schema:
|
||
$ref: '#/definitions/api.CreateNewsEventsReq'
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"201":
|
||
description: Created
|
||
"400":
|
||
description: Bad Request
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
security:
|
||
- CookieAuth: []
|
||
summary: Create a news/event
|
||
tags:
|
||
- news
|
||
/region/provinces:
|
||
get:
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
items:
|
||
additionalProperties: true
|
||
type: object
|
||
type: array
|
||
summary: List provinces
|
||
tags:
|
||
- regions
|
||
/region/regencies:
|
||
get:
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
items:
|
||
additionalProperties: true
|
||
type: object
|
||
type: array
|
||
summary: List regencies
|
||
tags:
|
||
- regions
|
||
/regions:
|
||
get:
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
items:
|
||
additionalProperties: true
|
||
type: object
|
||
type: array
|
||
summary: List all regions
|
||
tags:
|
||
- regions
|
||
/review/location:
|
||
post:
|
||
consumes:
|
||
- application/json
|
||
parameters:
|
||
- description: Review payload
|
||
in: body
|
||
name: body
|
||
required: true
|
||
schema:
|
||
$ref: '#/definitions/api.createReviewReq'
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
"400":
|
||
description: Bad Request
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
"409":
|
||
description: Conflict
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
security:
|
||
- CookieAuth: []
|
||
summary: Create a review
|
||
tags:
|
||
- reviews
|
||
/review/location/images:
|
||
post:
|
||
consumes:
|
||
- multipart/form-data
|
||
parameters:
|
||
- description: Review ID
|
||
in: formData
|
||
name: review_id
|
||
required: true
|
||
type: integer
|
||
- description: Image files
|
||
in: formData
|
||
name: images
|
||
required: true
|
||
type: file
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
"400":
|
||
description: Bad Request
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
security:
|
||
- CookieAuth: []
|
||
summary: Upload images for a review
|
||
tags:
|
||
- reviews
|
||
/user:
|
||
patch:
|
||
consumes:
|
||
- application/json
|
||
parameters:
|
||
- description: Update payload
|
||
in: body
|
||
name: body
|
||
required: true
|
||
schema:
|
||
$ref: '#/definitions/api.UpdateUserRequest'
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
"400":
|
||
description: Bad Request
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
security:
|
||
- CookieAuth: []
|
||
summary: Update user profile
|
||
tags:
|
||
- user
|
||
/user/avatar:
|
||
delete:
|
||
responses:
|
||
"204":
|
||
description: No Content
|
||
"500":
|
||
description: Internal Server Error
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
security:
|
||
- CookieAuth: []
|
||
summary: Remove user avatar
|
||
tags:
|
||
- user
|
||
patch:
|
||
consumes:
|
||
- multipart/form-data
|
||
parameters:
|
||
- description: Avatar image
|
||
in: formData
|
||
name: file
|
||
required: true
|
||
type: file
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
"500":
|
||
description: Internal Server Error
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
security:
|
||
- CookieAuth: []
|
||
summary: Upload user avatar
|
||
tags:
|
||
- user
|
||
/user/login:
|
||
post:
|
||
consumes:
|
||
- application/json
|
||
parameters:
|
||
- description: Login credentials
|
||
in: body
|
||
name: body
|
||
required: true
|
||
schema:
|
||
$ref: '#/definitions/api.createUserRequest'
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
"401":
|
||
description: Unauthorized
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
"404":
|
||
description: Not Found
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
summary: Login
|
||
tags:
|
||
- auth
|
||
/user/logout:
|
||
post:
|
||
responses:
|
||
"204":
|
||
description: No Content
|
||
summary: Logout
|
||
tags:
|
||
- auth
|
||
/user/profile:
|
||
get:
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
"401":
|
||
description: Unauthorized
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
security:
|
||
- CookieAuth: []
|
||
summary: Get current user profile and stats
|
||
tags:
|
||
- user
|
||
/user/review/location/{location_id}:
|
||
get:
|
||
parameters:
|
||
- description: Location ID
|
||
in: path
|
||
name: location_id
|
||
required: true
|
||
type: integer
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
"404":
|
||
description: Not Found
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
security:
|
||
- CookieAuth: []
|
||
summary: Get current user's review for a location
|
||
tags:
|
||
- reviews
|
||
/user/signup:
|
||
post:
|
||
consumes:
|
||
- application/json
|
||
parameters:
|
||
- description: Signup payload
|
||
in: body
|
||
name: body
|
||
required: true
|
||
schema:
|
||
$ref: '#/definitions/api.createUserRequest'
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: OK
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
"400":
|
||
description: Bad Request
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
"409":
|
||
description: Conflict
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
summary: Register a new user
|
||
tags:
|
||
- auth
|
||
securityDefinitions:
|
||
CookieAuth:
|
||
in: cookie
|
||
name: paseto
|
||
type: apiKey
|
||
swagger: "2.0"
|