legalgo-BE-go/openapi.yml
2025-02-25 11:25:36 +08:00

339 lines
9.0 KiB
YAML

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:
/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
required:
- email
- password
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
/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
- subscribe_plan_id
- phone
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-all:
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