WIP: Implement jsonresume #104

Draft
gulliver wants to merge 3 commits from implement_jsonresume into main
2 changed files with 51 additions and 0 deletions
Showing only changes of commit 383ef8b512 - Show all commits

28
ki/resume.py Normal file
View File

@ -0,0 +1,28 @@
from flask import Blueprint
bp_resume = Blueprint('resume', __name__,
template_folder='templates')
@bp_resume.route('/')
@token_auth
def show(page):
"""
return the list of resumes as object with data array inside
"""
return jsonify()
@bp_resume.route("/<resume_id>")
@token_auth
def get_resume(resume_id):
"""
lookup for resume with resume_id, check if its from this user and provide its contents
in the appropriate format
shall support 'format' parameter with values of 'html', 'pdf'
if no parameter is given, json is returned
"""
return jsonify(
id=resume_id
)

23
ki/resume_models.py Normal file
View File

@ -0,0 +1,23 @@
# SPDX-FileCopyrightText: WTF Kooperative eG <https://wtf-eg.de/>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
from datetime import datetime
from sqlalchemy import Boolean, Column, Integer, SmallInteger, String, DateTime, ForeignKey
from sqlalchemy.orm import relationship
from app import db
class Resume(db.Model):
__tablename__ = 'resume'
id = Column(Integer, primary_key=True)
profile_id = Column(Integer, ForeignKey("profile.id"), nullable=True)
def to_dict(self):
return {
"id": self.id,
'profile_id': profile_id
}