{ "openapi": "3.0.3", "info": { "title": "db-handler", "version": "0.0.1" }, "servers": [ { "description": "production server", "url": "http://0.0.0.0:7689" }, { "description": "staging server", "url": "http://0.0.0.0:7699" } ], "paths": { "/person": { "post": { "summary": "Create a new person", "operationId": "createPerson", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PersonProperties" } } } }, "responses": { "200": { "description": "Person created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Person" } } } } } } }, "/person/{id}": { "put": { "summary": "Update a person by ID", "operationId": "updatePerson", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PersonProperties" } } } }, "responses": { "200": { "description": "Person updated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Person" } } } } } }, "delete": { "summary": "Soft delete a person by ID", "operationId": "softDeletePerson", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "Person soft deleted", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Person" } } } } } } }, "/person/{id}/hard-delete": { "delete": { "summary": "Hard delete a person by ID", "operationId": "hardDeletePerson", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "Person hard deleted" } } } }, "/person/google/{google_id}": { "get": { "summary": "Get a person by Google ID", "operationId": "getPersonByGoogleId", "parameters": [ { "name": "google_id", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Person retrieved", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Person" } } } } } } }, "/person/{id}/family-tree": { "get": { "summary": "Get family tree by person ID", "operationId": "getFamilyTreeById", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "Family tree retrieved", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FamilyTree" } } } } } } }, "/relationship": { "post": { "summary": "Create a relationship between two persons", "operationId": "createRelationship", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "id1": { "type": "string" }, "id2": { "type": "string" }, "relationship": { "$ref": "#/components/schemas/FamilyRelationship" } } } } } }, "responses": { "200": { "description": "Relationship created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Relationship" } } } } } } }, "/relationship/{id1}/{id2}": { "get": { "summary": "Get relationship between two persons", "operationId": "getRelationship", "parameters": [ { "name": "id1", "in": "path", "required": true, "schema": { "type": "integer" } }, { "name": "id2", "in": "path", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "Relationship retrieved", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Relationship" } } } } } } }, "/recipe/{id}": { "put": { "summary": "Update a recipe by ID", "operationId": "updateRecipe", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RecipeProperties" } } } }, "responses": { "200": { "description": "Recipe updated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Recipe" } } } } } }, "delete": { "summary": "Soft delete a recipe by ID", "operationId": "softDeleteRecipe", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "Recipe soft deleted" } } } }, "/recipe/{id}/hard-delete": { "delete": { "summary": "Hard delete a recipe by ID", "operationId": "hardDeleteRecipe", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "Recipe hard deleted" } } } }, "/recipe/{recipeId}/relationship": { "post": { "summary": "Create a relationship with an existing recipe", "operationId": "createRecipeRelationship", "parameters": [ { "name": "recipeId", "in": "path", "required": true, "schema": { "type": "integer" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "integer" }, "relationship": { "type": "object", "properties": { "schema": { "$ref": "#/components/schemas/LikesProperties" } } } } } } } }, "responses": { "200": { "description": "Relationship with recipe created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Likes" } } } } } }, "delete": { "summary": "Delete a relationship with a recipe", "operationId": "deleteRecipeRelationship", "parameters": [ { "name": "recipeId", "in": "path", "required": true, "schema": { "type": "integer" } }, { "name": "personId", "in": "query", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "Relationship with recipe deleted" } } } } }, "components": { "schemas": { "PersonProperties": { "type": "object", "properties": { "allow_admin_access": { "type": "boolean" }, "invite_code": { "type": "string", "nullable": true }, "google_id": { "type": "string", "nullable": true }, "first_name": { "type": "string", "nullable": false }, "middle_name": { "type": "string", "nullable": true }, "last_name": { "type": "string", "nullable": false }, "titles": { "type": "array", "items": { "type": "string" }, "nullable": true }, "suffixes": { "type": "array", "items": { "type": "string" }, "nullable": true }, "extra_names": { "type": "array", "items": { "type": "string" }, "nullable": true }, "aliases": { "type": "array", "items": { "type": "string" }, "nullable": true }, "mothers_first_name": { "type": "string", "nullable": false }, "mothers_last_name": { "type": "string", "nullable": false }, "born": { "type": "string", "format": "date", "nullable": false }, "place_of_birth": { "type": "string", "nullable": true }, "died": { "type": "string", "format": "date", "nullable": true }, "place_of_death": { "type": "string", "nullable": true }, "life_events": { "type": "array", "items": { "type": "object", "properties": { "from": { "type": "string", "format": "date" }, "to": { "type": "string", "format": "date" }, "description": { "type": "string" } } }, "nullable": true }, "occupations": { "type": "array", "items": { "type": "string" }, "nullable": true }, "occupation_to_display": { "type": "string", "nullable": true }, "others_said": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "integer" }, "name": { "type": "string" }, "relationship": { "type": "string" }, "description": { "type": "string" }, "url": { "type": "string", "nullable": true } } }, "nullable": true }, "limit": { "type": "integer", "nullable": false }, "photos": { "type": "array", "items": { "type": "object", "properties": { "url": { "type": "string" }, "description": { "type": "string" }, "date":{ "type": "string", "format": "date" }, "name": { "type": "string" } } }, "nullable": true }, "videos": { "type": "array", "items": { "type": "object", "properties": { "url": { "type": "string" }, "description": { "type": "string" }, "date":{ "type": "string", "format": "date" }, "name": { "type": "string" } } }, "nullable": true }, "audios": { "type": "array", "items": { "type": "object", "properties": { "url": { "type": "string" }, "description": { "type": "string" }, "date":{ "type": "string", "format": "date" }, "name": { "type": "string" } } }, "nullable": true }, "profile_picture": { "type": "string", "nullable": true }, "verified": { "type": "boolean", "nullable": false }, "email": { "type": "string", "nullable": false }, "phone": { "type": "string", "nullable": true }, "residence": { "type": "object", "properties": { "city": { "type": "string" }, "country": { "type": "string" }, "zip_code": { "type": "string" }, "address_line_1": { "type": "string" }, "address_line_2": { "type": "string" } }, "nullable": true }, "religion": { "type": "string", "nullable": true }, "baptized": { "type": "string", "nullable": true }, "ideologies": { "type": "array", "items": { "type": "string" }, "nullable": true }, "blood_type": { "type": "string", "nullable": true }, "allergies": { "type": "array", "items": { "type": "string" }, "nullable": true }, "medications": { "type": "array", "nullable": true, "items": { "type": "object", "properties": { "name": { "type": "string" }, "description": { "type": "string", "nullable": true }, "components":{ "type": "string", "nullable": true }, "dosage": { "type": "string", "nullable": true }, "from": { "type": "string", "format": "date", "nullable": true }, "to": { "type": "string", "format": "date", "nullable": true } } } }, "medical_conditions": { "type": "array", "items": { "type": "object" } }, "height": { "type": "number", "nullable": true }, "weight": { "type": "number", "nullable": true }, "hair_colour": { "type": "string", "nullable": true }, "skin_colour": { "type": "string", "nullable": true }, "eye_colour": { "type": "string", "nullable": true }, "sports": { "type": "array", "items": { "type": "string" }, "nullable": true }, "hobbies": { "type": "array", "items": { "type": "string" }, "nullable": true }, "interests": { "type": "array", "items": { "type": "string" }, "nullable": true }, "languages": { "type": "array", "items": { "type": "object", "properties": { "language": { "type": "string" }, "level": { "type": "string", "nullable": true } } }, "nullable": true }, "notes": { "type": "array", "items": { "type": "object", "properties": { "date": { "type": "string", "format": "date", "nullable": true }, "title":{ "type": "string", "nullable": true }, "note": { "type": "string" }, "url": { "type": "string", "nullable": true } } }, "nullable": true } } }, "Person": { "type": "object", "properties": { "id": { "type": "integer" }, "labels": { "type": "array", "items": { "type": "string" } }, "type":{ "type": "string", "nullable": true }, "properties": { "$ref": "#/components/schemas/PersonProperties" } } }, "FamilyRelationship": { "type": "object", "properties": { "verified": { "type": "boolean", "nullable": false }, "notes": { "type": "string", "nullable": true }, "from": { "type": "string", "format": "date", "nullable": true }, "to": { "type": "string", "format": "date", "nullable": true } } }, "Relationship": { "type": "object", "properties": { "id": { "type": "integer" }, "label": { "type": "string" }, "type": { "type": "string", "nullable": true }, "start": { "type": "integer" }, "end": { "type": "integer" }, "properties": { "$ref": "#/components/schemas/FamilyRelationship" } } }, "OptimizedPersonNode":{ "type": "object", "properties": { "id": { "type": "integer" }, "labels": { "type": "array", "items": { "type": "string" } }, "type":{ "type": "string", "nullable": true }, "first_name": { "type": "string", "nullable": false }, "middle_name": { "type": "string", "nullable": true }, "last_name": { "type": "string", "nullable": false }, "born": { "type": "string", "format": "date", "nullable": false }, "died": { "type": "string", "format": "date", "nullable": true } } }, "FamilyTree": { "type": "object", "properties": { "ancestors": { "type": "array", "items": { "$ref": "#/components/schemas/OptimizedPersonNode" } }, "prel1": { "$ref": "#/components/schemas/Relationship" }, "children": { "type": "array", "items": { "$ref": "#/components/schemas/OptimizedPersonNode" } }, "prel2": { "$ref": "#/components/schemas/Relationship" }, "spouses": { "type": "string" }, "srel": { "$ref": "#/components/schemas/Relationship" }, "user": { "type": "string" } } }, "RecipeProperties": { "type": "object", "properties": { "name": { "type": "string" }, "origin": { "type": "string" }, "category": { "type": "string" }, "first_recorded": { "type": "string", "format": "date" }, "description": { "type": "string" }, "ingredients": { "type": "array", "items": { "type": "string" } }, "instructions": { "type": "array", "items": { "type": "string" } }, "photo": { "type": "string" }, "notes": { "type": "string" } } }, "Recipe": { "type": "object", "properties": { "id": { "type": "integer" }, "labels": { "type": "array", "items": { "type": "string" } }, "properties": { "$ref": "#/components/schemas/RecipeProperties" } } }, "Likes": { "type": "object", "properties": { "id": { "type": "integer" }, "label": { "type": "string" }, "start": { "type": "string" }, "end": { "type": "string" }, "properties": { "$ref": "#/components/schemas/LikesProperties" } } }, "LikesProperties": { "type": "object", "properties": { "favourite": { "type": "boolean" }, "like_it": { "type": "boolean" }, "could_make_it": { "type": "boolean" } } } } } }