2025-02-24 20:27:07 +08:00
|
|
|
openapi: 3.0.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:
|
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
|
|
|
|
|
required:
|
|
|
|
|
- email
|
|
|
|
|
- password
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
- subscribe_plan_id
|
|
|
|
|
- phone
|
|
|
|
|
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
|
|
|
|
2025-02-25 14:23:59 +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
|