def skill_detail_by_id(id):
    """
        Gets a skill from DB by id
        Args:
            id: desired skill id
        Returns: SkillSchema Object

    """
    skill = Skill.query.get_or_404(id)
    return skill_schema.dump(skill)
def skill_detail_by_name(skill_name):
    """
        Gets a skill from DB by name
        Args:
            skill_name: desired skill name
        Returns: SkillSchema Object

    """
    found_skill = Skill.query.filter_by(name=skill_name).first_or_404(
        description=f'There is no data with - {skill_name}')
    return skill_schema.dump(found_skill)
def delete_skill(skill_id):
    """
        Gets a skill from DB by id
        Args:
            id: desired skill id
        Returns: SkillSchema Object

    """
    skill = Skill.query.get_or_404(skill_id)
    db.session.delete(skill)
    db.session.commit()
    return skill_schema.dump(skill)
示例#4
0
def delete_skill(skill_id):
    skill = Skill.query.get_or_404(skill_id)
    db.session.delete(skill)
    db.session.commit()
    return skill_schema.dump(skill)
示例#5
0
def show_skill(skill_name):
    found_skill = Skill.query.filter_by(name=skill_name).first_or_404(
        description='There is no data with - {}'.format(skill_name))
    return skill_schema.dump(found_skill)
示例#6
0
def skill_detail(id):
    skill = Skill.query.get_or_404(id)
    return skill_schema.dump(skill)