legalgo-BE-go/openapi.yml

798 lines
22 KiB
YAML
Raw Normal View History

2025-02-28 22:03:47 +08:00
openapi: 3.0.0
2025-02-24 20:27:07 +08:00
info:
title: Staff and User API
version: 1.0.0
description: API for handling staff and user login, registration, and subscription plan creation.
paths:
2025-03-01 21:20:51 +08:00
/staff/profile:
get:
summary: "get staff profile"
tags:
- Staff
responses:
"200":
description: Success get profile
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
id:
type: string
email:
type: string
name:
type: string
profile_picture:
2025-03-01 21:20:51 +08:00
type: string
"400":
description: Bad request
content:
application/json:
schema:
type: object
properties:
error:
type: object
properties:
code:
type: string
message:
type: string
2025-02-24 20:30:10 +08:00
/staff/login:
2025-02-24 20:27:07 +08:00
post:
summary: Login for staff
2025-02-25 11:07:17 +08:00
tags:
- Staff
2025-02-24 20:27:07 +08:00
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
email:
type: string
format: email
password:
type: string
required:
- email
- password
responses:
"200":
description: Successful login
2025-02-25 11:07:17 +08:00
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
token:
type: string
description: JWT token for staff authentication
2025-02-24 20:27:07 +08:00
"400":
description: Bad request
2025-02-25 11:07:17 +08:00
content:
application/json:
schema:
type: object
properties:
error:
type: object
properties:
code:
type: string
message:
type: string
2025-02-24 20:27:07 +08:00
2025-02-24 20:30:10 +08:00
/staff/register:
2025-02-24 20:27:07 +08:00
post:
summary: Register a new staff member
2025-02-25 11:07:17 +08:00
tags:
- Staff
2025-02-24 20:27:07 +08:00
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
email:
type: string
format: email
password:
type: string
name:
type: string
profile_picture:
2025-02-27 10:27:57 +08:00
type: string
2025-02-24 20:27:07 +08:00
required:
- email
- password
- name
2025-02-24 20:27:07 +08:00
responses:
"201":
description: Staff member created
2025-02-25 11:07:17 +08:00
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
token:
type: string
description: JWT token for staff authentication
2025-02-24 20:27:07 +08:00
"400":
description: Bad request
2025-02-25 11:07:17 +08:00
content:
application/json:
schema:
type: object
properties:
error:
type: object
properties:
code:
type: string
message:
type: string
2025-02-24 20:27:07 +08:00
"409":
description: Conflict (email already registered)
2025-02-25 11:07:17 +08:00
content:
application/json:
schema:
type: object
properties:
error:
type: object
2025-02-27 18:59:58 +08:00
properties:
code:
type: string
message:
type: string
/user/profile:
2025-02-27 18:59:58 +08:00
get:
summary: "get staff profile"
tags:
2025-02-28 22:03:47 +08:00
- User
2025-02-27 18:59:58 +08:00
responses:
"200":
description: Success get profile
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
id:
type: string
email:
type: string
subscribe_plan_code:
type: string
subscribe_plan_name:
type: string
subscribe_status:
type: string
"400":
description: Bad request
content:
application/json:
schema:
type: object
properties:
error:
type: object
2025-02-25 11:07:17 +08:00
properties:
code:
type: string
message:
type: string
2025-02-24 20:27:07 +08:00
2025-02-24 20:30:10 +08:00
/user/login:
2025-02-24 20:27:07 +08:00
post:
summary: Login for user
2025-02-25 11:07:17 +08:00
tags:
- User
2025-02-24 20:27:07 +08:00
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
email:
type: string
format: email
password:
type: string
required:
- email
- password
responses:
"200":
description: Successful login
2025-02-25 11:07:17 +08:00
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
token:
type: string
description: JWT token for user authentication
2025-02-24 20:27:07 +08:00
"400":
description: Bad request
2025-02-25 11:07:17 +08:00
content:
application/json:
schema:
type: object
properties:
error:
type: object
properties:
code:
type: string
message:
type: string
2025-02-24 20:27:07 +08:00
2025-02-24 20:30:10 +08:00
/user/register:
2025-02-24 20:27:07 +08:00
post:
summary: Register a new user
2025-02-25 11:07:17 +08:00
tags:
- User
2025-02-24 20:27:07 +08:00
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
email:
type: string
format: email
password:
type: string
subscribe_plan_id:
type: string
phone:
type: string
format: phone
required:
- email
- password
responses:
"201":
description: User created
2025-02-25 11:07:17 +08:00
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
token:
type: string
description: JWT token for user authentication
2025-02-24 20:27:07 +08:00
"400":
description: Bad request
2025-02-25 11:07:17 +08:00
content:
application/json:
schema:
type: object
properties:
error:
type: object
properties:
code:
type: string
message:
type: string
2025-02-24 20:27:07 +08:00
"409":
description: Conflict (email already registered)
2025-02-25 11:07:17 +08:00
content:
application/json:
schema:
type: object
properties:
error:
type: object
properties:
code:
type: string
message:
type: string
2025-02-24 20:27:07 +08:00
/subscribe-plan/create:
post:
summary: Create a new subscription plan
2025-02-25 11:07:17 +08:00
tags:
- Subscribe Plan
2025-02-24 20:27:07 +08:00
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
2025-02-25 11:07:17 +08:00
name:
type: string
2025-02-24 20:27:07 +08:00
code:
type: string
required:
- code
2025-02-25 11:07:17 +08:00
- name
2025-02-24 20:27:07 +08:00
responses:
"201":
description: Subscription plan created
2025-02-25 11:07:17 +08:00
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
message:
type: string
example: "Subscription plan created successfully."
2025-02-24 20:27:07 +08:00
"400":
description: Bad request
2025-02-25 11:07:17 +08:00
content:
application/json:
schema:
type: object
properties:
error:
type: object
properties:
code:
type: string
message:
type: string
2025-02-24 20:27:07 +08:00
"409":
description: Conflict (plan code already exists)
2025-02-25 11:07:17 +08:00
content:
application/json:
schema:
type: object
properties:
error:
type: object
properties:
code:
type: string
message:
type: string
2025-02-24 20:27:07 +08:00
/subscribe-plan:
2025-02-24 20:32:08 +08:00
get:
2025-02-25 11:07:17 +08:00
summary: Get all subscription plans
tags:
- Subscribe Plan
2025-02-24 20:27:07 +08:00
responses:
2025-02-25 11:07:17 +08:00
"200":
description: Successfully retrieved all subscription plans
content:
application/json:
schema:
type: object
properties:
data:
type: array
items:
type: object
properties:
id:
type: string
code:
type: string
name:
type: string
2025-02-24 20:27:07 +08:00
"400":
description: Bad request
2025-02-25 11:07:17 +08:00
content:
application/json:
schema:
type: object
properties:
error:
type: object
properties:
code:
type: string
message:
type: string
2025-03-01 20:00:54 +08:00
/tag:
get:
summary: Get all tags
tags:
- Tags
responses:
"200":
description: Successfully retrieved all tags
content:
application/json:
schema:
type: object
properties:
data:
type: array
items:
type: object
properties:
id:
type: string
code:
type: string
name:
type: string
"400":
description: Bad request
content:
application/json:
schema:
type: object
properties:
error:
type: object
properties:
code:
type: string
message:
type: string
/tag/create:
post:
summary: Create a new tag
tags:
- Tags
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name:
type: string
code:
type: string
required:
- code
- name
responses:
"201":
description: Tag created
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
message:
type: string
example: "tag created successfully."
"400":
description: Bad request
content:
application/json:
schema:
type: object
properties:
error:
type: object
properties:
code:
type: string
message:
type: string
"409":
description: Conflict (tag code already exists)
content:
application/json:
schema:
type: object
properties:
error:
type: object
properties:
code:
type: string
message:
type: string
2025-03-01 21:20:51 +08:00
/category:
get:
summary: Get all categories
tags:
- Category
responses:
"200":
description: Successfully retrieved all categories
content:
application/json:
schema:
type: object
properties:
data:
type: array
items:
type: object
properties:
id:
type: string
code:
type: string
name:
type: string
"400":
description: Bad request
content:
application/json:
schema:
type: object
properties:
error:
type: object
properties:
code:
type: string
message:
type: string
/category/create:
post:
summary: Create a new category
tags:
2025-03-02 04:36:17 +08:00
- Category
2025-03-01 21:20:51 +08:00
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name:
type: string
code:
type: string
required:
- code
- name
responses:
"201":
description: Category created
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
message:
type: string
example: "category created successfully."
"400":
description: Bad request
content:
application/json:
schema:
type: object
properties:
error:
type: object
properties:
code:
type: string
message:
type: string
"409":
description: Conflict (category code already exists)
content:
application/json:
schema:
type: object
properties:
error:
type: object
properties:
code:
type: string
message:
type: string
2025-03-02 04:36:17 +08:00
/news/create:
post:
summary: Create a new news article
tags:
- News
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
title:
type: string
content:
type: string
featured_image:
type: string
format: uri
tags:
type: array
items:
type: string
categories:
type: array
items:
type: string
is_premium:
type: boolean
live_at:
type: string
format: date-time
required:
- title
- content
- featured_image
- tags
- categories
- is_premium
- live_at
responses:
"201":
description: News article created
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
message:
type: string
example: "news created successfully."
"400":
description: Bad request
content:
application/json:
schema:
type: object
properties:
error:
type: object
properties:
code:
type: string
message:
type: string
"409":
description: Conflict (e.g., duplicate title or invalid tag/category)
content:
application/json:
schema:
type: object
properties:
error:
type: object
properties:
code:
type: string
message:
type: string
/news:
get:
summary: Get all news articles
tags:
- News
responses:
"200":
description: Successfully retrieved all news articles
content:
application/json:
schema:
type: object
properties:
data:
type: array
items:
type: object
properties:
id:
type: string
title:
type: string
content:
type: string
categories:
type: array
items:
type: object
properties:
id:
type: string
name:
type: string
code:
type: string
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
tags:
type: array
items:
type: object
properties:
id:
type: string
name:
type: string
code:
type: string
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
is_premium:
type: boolean
slug:
type: string
featured_image:
type: string
format: uri
author_id:
type: string
live_at:
type: string
format: date-time
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
"400":
description: Bad request
content:
application/json:
schema:
type: object
properties:
error:
type: object
properties:
code:
type: string
message:
type: string