WIP: Starting project resume endpoints #17

Draft
dunossauro wants to merge 4 commits from feature/resume into main
Member

The main object of this PR is starting a discussion about endpoint names and database modeling.

To test then:

uv sync
uv run task run

After that, access localhost:8000

PSC: @thiagojedi, @Riverfount and @gutocarvalho

image

image

image

OpenAPI:

{
  "openapi": "3.1.0",
  "info": {
    "title": "Vitae API",
    "description": "Vitae is a fastAPI project to manage CV and resumes integrated with Fediverse.",
    "version": "0.1.0"
  },
  "paths": {
    "/resume/users/": {
      "post": {
        "tags": [
          "resume"
        ],
        "summary": "Create User",
        "operationId": "create_user_resume_users__post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UserCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserRead"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/resume/experiences/": {
      "post": {
        "tags": [
          "resume"
        ],
        "summary": "Create Experience",
        "operationId": "create_experience_resume_experiences__post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExperienceCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExperienceRead"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed"
          },
          "404": {
            "description": "User not found"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/resume/educations/": {
      "post": {
        "tags": [
          "resume"
        ],
        "summary": "Create Education",
        "operationId": "create_education_resume_educations__post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EducationCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EducationRead"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed"
          },
          "404": {
            "description": "User not found"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/resume/users/{user_id}": {
      "get": {
        "tags": [
          "resume"
        ],
        "summary": "Get User Complete",
        "operationId": "get_user_complete_resume_users__user_id__get",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "User Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserCompleteRead"
                }
              }
            }
          },
          "404": {
            "description": "User not found"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/": {
      "get": {
        "summary": "Read Root",
        "operationId": "read_root__get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "EducationCreate": {
        "properties": {
          "user_id": {
            "type": "integer",
            "title": "User Id"
          },
          "institution": {
            "type": "string",
            "title": "Institution"
          },
          "degree": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Degree"
          },
          "field_of_study": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Field Of Study"
          },
          "start_date": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ],
            "title": "Start Date"
          },
          "end_date": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ],
            "title": "End Date"
          }
        },
        "type": "object",
        "required": [
          "user_id",
          "institution"
        ],
        "title": "EducationCreate"
      },
      "EducationRead": {
        "properties": {
          "id": {
            "type": "integer",
            "title": "Id"
          },
          "institution": {
            "type": "string",
            "title": "Institution"
          },
          "degree": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Degree"
          },
          "field_of_study": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Field Of Study"
          },
          "start_date": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ],
            "title": "Start Date"
          },
          "end_date": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ],
            "title": "End Date"
          }
        },
        "type": "object",
        "required": [
          "id",
          "institution"
        ],
        "title": "EducationRead"
      },
      "ExperienceCreate": {
        "properties": {
          "title": {
            "type": "string",
            "title": "Title"
          },
          "company": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Company"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "start_date": {
            "type": "string",
            "format": "date",
            "title": "Start Date"
          },
          "end_date": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ],
            "title": "End Date"
          },
          "user_id": {
            "type": "integer",
            "title": "User Id"
          }
        },
        "type": "object",
        "required": [
          "title",
          "start_date",
          "user_id"
        ],
        "title": "ExperienceCreate"
      },
      "ExperienceRead": {
        "properties": {
          "id": {
            "type": "integer",
            "title": "Id"
          },
          "title": {
            "type": "string",
            "title": "Title"
          },
          "company": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Company"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "start_date": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ],
            "title": "Start Date"
          },
          "end_date": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ],
            "title": "End Date"
          }
        },
        "type": "object",
        "required": [
          "id",
          "title"
        ],
        "title": "ExperienceRead"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "UserCompleteRead": {
        "properties": {
          "id": {
            "type": "integer",
            "title": "Id"
          },
          "first_name": {
            "type": "string",
            "title": "First Name"
          },
          "last_name": {
            "type": "string",
            "title": "Last Name"
          },
          "email": {
            "type": "string",
            "format": "email",
            "title": "Email"
          },
          "phone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Phone"
          },
          "display_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Display Name"
          },
          "experiences": {
            "items": {
              "$ref": "#/components/schemas/ExperienceRead"
            },
            "type": "array",
            "title": "Experiences",
            "default": []
          },
          "educations": {
            "items": {
              "$ref": "#/components/schemas/EducationRead"
            },
            "type": "array",
            "title": "Educations",
            "default": []
          }
        },
        "type": "object",
        "required": [
          "id",
          "first_name",
          "last_name",
          "email"
        ],
        "title": "UserCompleteRead"
      },
      "UserCreate": {
        "properties": {
          "first_name": {
            "type": "string",
            "title": "First Name"
          },
          "last_name": {
            "type": "string",
            "title": "Last Name"
          },
          "email": {
            "type": "string",
            "format": "email",
            "title": "Email"
          },
          "phone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Phone"
          },
          "display_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Display Name"
          }
        },
        "type": "object",
        "required": [
          "first_name",
          "last_name",
          "email"
        ],
        "title": "UserCreate"
      },
      "UserRead": {
        "properties": {
          "id": {
            "type": "integer",
            "title": "Id"
          },
          "first_name": {
            "type": "string",
            "title": "First Name"
          },
          "last_name": {
            "type": "string",
            "title": "Last Name"
          },
          "email": {
            "type": "string",
            "format": "email",
            "title": "Email"
          },
          "phone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Phone"
          },
          "display_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Display Name"
          }
        },
        "type": "object",
        "required": [
          "id",
          "first_name",
          "last_name",
          "email"
        ],
        "title": "UserRead"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      }
    }
  }
}
The main object of this PR is starting a discussion about endpoint names and database modeling. To test then: ```bash uv sync uv run task run ``` After that, access `localhost:8000` PSC: @thiagojedi, @Riverfount and @gutocarvalho ![image](/attachments/24549158-8a0e-4986-9928-cb33922963ab) ![image](/attachments/857d9564-66e6-4a24-a025-9155801afd85) ![image](/attachments/45f60b0a-4649-4cc8-af35-2859d11030b5) OpenAPI: ```json { "openapi": "3.1.0", "info": { "title": "Vitae API", "description": "Vitae is a fastAPI project to manage CV and resumes integrated with Fediverse.", "version": "0.1.0" }, "paths": { "/resume/users/": { "post": { "tags": [ "resume" ], "summary": "Create User", "operationId": "create_user_resume_users__post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserCreate" } } }, "required": true }, "responses": { "201": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserRead" } } } }, "400": { "description": "Validation failed" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/resume/experiences/": { "post": { "tags": [ "resume" ], "summary": "Create Experience", "operationId": "create_experience_resume_experiences__post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ExperienceCreate" } } }, "required": true }, "responses": { "201": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ExperienceRead" } } } }, "400": { "description": "Validation failed" }, "404": { "description": "User not found" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/resume/educations/": { "post": { "tags": [ "resume" ], "summary": "Create Education", "operationId": "create_education_resume_educations__post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/EducationCreate" } } }, "required": true }, "responses": { "201": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/EducationRead" } } } }, "400": { "description": "Validation failed" }, "404": { "description": "User not found" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/resume/users/{user_id}": { "get": { "tags": [ "resume" ], "summary": "Get User Complete", "operationId": "get_user_complete_resume_users__user_id__get", "parameters": [ { "name": "user_id", "in": "path", "required": true, "schema": { "type": "integer", "title": "User Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserCompleteRead" } } } }, "404": { "description": "User not found" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/": { "get": { "summary": "Read Root", "operationId": "read_root__get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } } } } } }, "components": { "schemas": { "EducationCreate": { "properties": { "user_id": { "type": "integer", "title": "User Id" }, "institution": { "type": "string", "title": "Institution" }, "degree": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Degree" }, "field_of_study": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Field Of Study" }, "start_date": { "anyOf": [ { "type": "string", "format": "date" }, { "type": "null" } ], "title": "Start Date" }, "end_date": { "anyOf": [ { "type": "string", "format": "date" }, { "type": "null" } ], "title": "End Date" } }, "type": "object", "required": [ "user_id", "institution" ], "title": "EducationCreate" }, "EducationRead": { "properties": { "id": { "type": "integer", "title": "Id" }, "institution": { "type": "string", "title": "Institution" }, "degree": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Degree" }, "field_of_study": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Field Of Study" }, "start_date": { "anyOf": [ { "type": "string", "format": "date" }, { "type": "null" } ], "title": "Start Date" }, "end_date": { "anyOf": [ { "type": "string", "format": "date" }, { "type": "null" } ], "title": "End Date" } }, "type": "object", "required": [ "id", "institution" ], "title": "EducationRead" }, "ExperienceCreate": { "properties": { "title": { "type": "string", "title": "Title" }, "company": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Company" }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Description" }, "start_date": { "type": "string", "format": "date", "title": "Start Date" }, "end_date": { "anyOf": [ { "type": "string", "format": "date" }, { "type": "null" } ], "title": "End Date" }, "user_id": { "type": "integer", "title": "User Id" } }, "type": "object", "required": [ "title", "start_date", "user_id" ], "title": "ExperienceCreate" }, "ExperienceRead": { "properties": { "id": { "type": "integer", "title": "Id" }, "title": { "type": "string", "title": "Title" }, "company": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Company" }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Description" }, "start_date": { "anyOf": [ { "type": "string", "format": "date" }, { "type": "null" } ], "title": "Start Date" }, "end_date": { "anyOf": [ { "type": "string", "format": "date" }, { "type": "null" } ], "title": "End Date" } }, "type": "object", "required": [ "id", "title" ], "title": "ExperienceRead" }, "HTTPValidationError": { "properties": { "detail": { "items": { "$ref": "#/components/schemas/ValidationError" }, "type": "array", "title": "Detail" } }, "type": "object", "title": "HTTPValidationError" }, "UserCompleteRead": { "properties": { "id": { "type": "integer", "title": "Id" }, "first_name": { "type": "string", "title": "First Name" }, "last_name": { "type": "string", "title": "Last Name" }, "email": { "type": "string", "format": "email", "title": "Email" }, "phone": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Phone" }, "display_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Display Name" }, "experiences": { "items": { "$ref": "#/components/schemas/ExperienceRead" }, "type": "array", "title": "Experiences", "default": [] }, "educations": { "items": { "$ref": "#/components/schemas/EducationRead" }, "type": "array", "title": "Educations", "default": [] } }, "type": "object", "required": [ "id", "first_name", "last_name", "email" ], "title": "UserCompleteRead" }, "UserCreate": { "properties": { "first_name": { "type": "string", "title": "First Name" }, "last_name": { "type": "string", "title": "Last Name" }, "email": { "type": "string", "format": "email", "title": "Email" }, "phone": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Phone" }, "display_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Display Name" } }, "type": "object", "required": [ "first_name", "last_name", "email" ], "title": "UserCreate" }, "UserRead": { "properties": { "id": { "type": "integer", "title": "Id" }, "first_name": { "type": "string", "title": "First Name" }, "last_name": { "type": "string", "title": "Last Name" }, "email": { "type": "string", "format": "email", "title": "Email" }, "phone": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Phone" }, "display_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Display Name" } }, "type": "object", "required": [ "id", "first_name", "last_name", "email" ], "title": "UserRead" }, "ValidationError": { "properties": { "loc": { "items": { "anyOf": [ { "type": "string" }, { "type": "integer" } ] }, "type": "array", "title": "Location" }, "msg": { "type": "string", "title": "Message" }, "type": { "type": "string", "title": "Error Type" } }, "type": "object", "required": [ "loc", "msg", "type" ], "title": "ValidationError" } } } } ```
This pull request is marked as a work in progress.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feature/resume:feature/resume
git switch feature/resume

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff feature/resume
git switch feature/resume
git rebase main
git switch main
git merge --ff-only feature/resume
git switch feature/resume
git rebase main
git switch main
git merge --no-ff feature/resume
git switch main
git merge --squash feature/resume
git switch main
git merge --ff-only feature/resume
git switch main
git merge feature/resume
git push origin main
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: vitae/backend-vitae#17
No description provided.