176 lines
4.8 KiB
YAML
176 lines
4.8 KiB
YAML
openapi: 3.0.3
|
|
info:
|
|
title: Emergency Contact API - Al Rahma Sunday School
|
|
version: 1.0.0
|
|
description: Manage emergency contacts for parents and students.
|
|
servers:
|
|
- url: https://your-domain.com/api/v1
|
|
security:
|
|
- bearerAuth: []
|
|
tags:
|
|
- name: Emergency Contacts
|
|
description: CRUD operations for emergency contacts
|
|
|
|
paths:
|
|
/emergency-contacts:
|
|
get:
|
|
tags: [Emergency Contacts]
|
|
summary: List emergency contacts
|
|
parameters:
|
|
- in: query
|
|
name: parent_id
|
|
schema: { type: integer }
|
|
- in: query
|
|
name: student_id
|
|
schema: { type: integer }
|
|
- in: query
|
|
name: school_year
|
|
schema: { type: string }
|
|
- in: query
|
|
name: semester
|
|
schema: { type: string }
|
|
- in: query
|
|
name: page
|
|
schema: { type: integer, default: 1 }
|
|
- in: query
|
|
name: per_page
|
|
schema: { type: integer, default: 20 }
|
|
responses:
|
|
"200":
|
|
description: Emergency contacts list
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/EmergencyContactsResponse'
|
|
post:
|
|
tags: [Emergency Contacts]
|
|
summary: Create a new emergency contact
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/SaveEmergencyContactRequest'
|
|
responses:
|
|
"201":
|
|
description: Created
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/EmergencyContactResponse'
|
|
|
|
/emergency-contacts/{id}:
|
|
parameters:
|
|
- in: path
|
|
name: id
|
|
required: true
|
|
schema: { type: integer }
|
|
get:
|
|
tags: [Emergency Contacts]
|
|
summary: Retrieve an emergency contact
|
|
responses:
|
|
"200":
|
|
description: Emergency contact details
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/EmergencyContactResponse'
|
|
"404":
|
|
description: Not found
|
|
put:
|
|
tags: [Emergency Contacts]
|
|
summary: Update an emergency contact
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/SaveEmergencyContactRequest'
|
|
responses:
|
|
"200":
|
|
description: Updated
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/EmergencyContactResponse'
|
|
delete:
|
|
tags: [Emergency Contacts]
|
|
summary: Delete an emergency contact
|
|
responses:
|
|
"200":
|
|
description: Deleted
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/BasicSuccess'
|
|
|
|
/emergency-contacts/parent/{id}:
|
|
get:
|
|
tags: [Emergency Contacts]
|
|
summary: List emergency contacts for a parent
|
|
parameters:
|
|
- in: path
|
|
name: id
|
|
required: true
|
|
schema: { type: integer }
|
|
responses:
|
|
"200":
|
|
description: Parent emergency contacts
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/EmergencyContactsResponse'
|
|
|
|
components:
|
|
schemas:
|
|
EmergencyContact:
|
|
type: object
|
|
properties:
|
|
id: { type: integer }
|
|
parent_id: { type: integer }
|
|
emergency_contact_name: { type: string }
|
|
cellphone: { type: string }
|
|
email: { type: string, nullable: true }
|
|
relation: { type: string, nullable: true }
|
|
school_year: { type: string }
|
|
semester: { type: string }
|
|
created_at: { type: string, format: date-time }
|
|
updated_at: { type: string, format: date-time }
|
|
|
|
EmergencyContactsResponse:
|
|
type: object
|
|
properties:
|
|
status: { type: string }
|
|
message: { type: string }
|
|
data:
|
|
type: array
|
|
items:
|
|
$ref: '#/components/schemas/EmergencyContact'
|
|
|
|
EmergencyContactResponse:
|
|
type: object
|
|
properties:
|
|
status: { type: string }
|
|
message: { type: string }
|
|
data:
|
|
$ref: '#/components/schemas/EmergencyContact'
|
|
|
|
SaveEmergencyContactRequest:
|
|
type: object
|
|
required: [parent_id, emergency_contact_name, cellphone, relation, school_year, semester]
|
|
properties:
|
|
parent_id: { type: integer }
|
|
emergency_contact_name: { type: string }
|
|
cellphone: { type: string }
|
|
email: { type: string, nullable: true }
|
|
relation: { type: string }
|
|
school_year: { type: string }
|
|
semester: { type: string }
|
|
|
|
BasicSuccess:
|
|
type: object
|
|
properties:
|
|
status: { type: string }
|
|
message: { type: string }
|
|
data: {}
|