legalgo-BE-go/openapi.yml
2025-02-27 18:59:58 +08:00

432 lines
11 KiB
YAML

openapi: 3.1.0
info:
title: Staff and User API
version: 1.0.0
description: API for handling staff and user login, registration, and subscription plan creation.
paths:
/staff/login:
post:
summary: Login for staff
tags:
- Staff
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
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
token:
type: string
description: JWT token for staff authentication
"400":
description: Bad request
content:
application/json:
schema:
type: object
properties:
error:
type: object
properties:
code:
type: string
message:
type: string
/staff/register:
post:
summary: Register a new staff member
tags:
- Staff
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
email:
type: string
format: email
password:
type: string
username:
type: string
required:
- email
- password
- username
responses:
"201":
description: Staff member created
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
token:
type: string
description: JWT token for staff authentication
"400":
description: Bad request
content:
application/json:
schema:
type: object
properties:
error:
type: object
properties:
code:
type: string
message:
type: string
"409":
description: Conflict (email already registered)
content:
application/json:
schema:
type: object
properties:
error:
type: object
properties:
code:
type: string
message:
type: string
/staff/{id}/profile:
get:
summary: "get staff profile"
tags:
- staff
parameters:
- name: "id"
in: query
description: "staff id"
required: true
schema:
type: string
responses:
"200":
description: Success get profile
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
id:
type: string
email:
type: string
username:
type: string
"400":
description: Bad request
content:
application/json:
schema:
type: object
properties:
error:
type: object
properties:
code:
type: string
message:
type: string
/user/{id}/profile:
get:
summary: "get staff profile"
tags:
- user
parameters:
- name: "id"
in: query
description: "user id"
required: true
schema:
type: string
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
properties:
code:
type: string
message:
type: string
/user/login:
post:
summary: Login for user
tags:
- User
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
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
token:
type: string
description: JWT token for user authentication
"400":
description: Bad request
content:
application/json:
schema:
type: object
properties:
error:
type: object
properties:
code:
type: string
message:
type: string
/user/register:
post:
summary: Register a new user
tags:
- User
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
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
token:
type: string
description: JWT token for user authentication
"400":
description: Bad request
content:
application/json:
schema:
type: object
properties:
error:
type: object
properties:
code:
type: string
message:
type: string
"409":
description: Conflict (email already registered)
content:
application/json:
schema:
type: object
properties:
error:
type: object
properties:
code:
type: string
message:
type: string
/subscribe-plan/create:
post:
summary: Create a new subscription plan
tags:
- Subscribe Plan
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name:
type: string
code:
type: string
required:
- code
- name
responses:
"201":
description: Subscription plan created
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
message:
type: string
example: "Subscription plan 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 (plan code already exists)
content:
application/json:
schema:
type: object
properties:
error:
type: object
properties:
code:
type: string
message:
type: string
/subscribe-plan:
get:
summary: Get all subscription plans
tags:
- Subscribe Plan
responses:
"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
"400":
description: Bad request
content:
application/json:
schema:
type: object
properties:
error:
type: object
properties:
code:
type: string
message:
type: string