108 lines
2.9 KiB
YAML
108 lines
2.9 KiB
YAML
openapi: 3.0.3
|
|
info: { title: Invoice API, version: 1.0.0 }
|
|
servers: [ { url: https://your-domain.com/api/v1 } ]
|
|
tags: [ { name: Invoices } ]
|
|
security: [ { bearerAuth: [] } ]
|
|
|
|
paths:
|
|
/invoices:
|
|
get:
|
|
tags: [Invoices]
|
|
summary: List invoices
|
|
parameters:
|
|
- in: query
|
|
name: page
|
|
schema: { type: integer, default: 1 }
|
|
- in: query
|
|
name: per_page
|
|
schema: { type: integer, default: 20 }
|
|
- in: query
|
|
name: parent_id
|
|
schema: { type: integer }
|
|
- in: query
|
|
name: status
|
|
schema: { type: string }
|
|
responses:
|
|
"200": { description: Invoices retrieved }
|
|
post:
|
|
tags: [Invoices]
|
|
summary: Create invoice
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
required: [invoice_number, total_amount, issue_date, status]
|
|
properties:
|
|
parent_id: { type: integer }
|
|
invoice_number: { type: string }
|
|
total_amount: { type: number }
|
|
balance: { type: number }
|
|
paid_amount: { type: number }
|
|
school_year: { type: string }
|
|
semester: { type: string }
|
|
issue_date: { type: string, format: date-time }
|
|
due_date: { type: string, format: date-time }
|
|
status: { type: string }
|
|
description: { type: string }
|
|
responses:
|
|
"201": { description: Invoice created }
|
|
|
|
/invoices/{id}:
|
|
get:
|
|
tags: [Invoices]
|
|
summary: Get invoice by ID
|
|
parameters:
|
|
- in: path
|
|
name: id
|
|
required: true
|
|
schema: { type: integer }
|
|
responses:
|
|
"200": { description: Invoice }
|
|
"404": { description: Not found }
|
|
put:
|
|
tags: [Invoices]
|
|
summary: Update invoice
|
|
parameters:
|
|
- in: path
|
|
name: id
|
|
required: true
|
|
schema: { type: integer }
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
status: { type: string }
|
|
paid_amount: { type: number }
|
|
balance: { type: number }
|
|
description: { type: string }
|
|
responses:
|
|
"200": { description: Invoice updated }
|
|
delete:
|
|
tags: [Invoices]
|
|
summary: Delete invoice
|
|
parameters:
|
|
- in: path
|
|
name: id
|
|
required: true
|
|
schema: { type: integer }
|
|
responses:
|
|
"200": { description: Invoice deleted }
|
|
|
|
/invoices/parent/{id}:
|
|
get:
|
|
tags: [Invoices]
|
|
summary: List invoices by parent
|
|
parameters:
|
|
- in: path
|
|
name: id
|
|
required: true
|
|
schema: { type: integer }
|
|
responses:
|
|
"200": { description: Parent invoices list }
|
|
|