Beispiel #1
0
    def put(self, id):
        """Actualiza un terapista por su ID"""

        doctorInput = request.get_json(force=True)
        ter_nombre = doctorInput['ter_nombre']
        ter_apellido = doctorInput['ter_apellido']
        ter_tel = doctorInput['ter_tel']
        ter_dir = doctorInput['ter_dir']
        conn.execute(
            "UPDATE terapistas SET ter_nombre=?,ter_apellido=?,ter_tel=?,ter_dir=? WHERE ter_id=?",
            (ter_nombre, ter_apellido, ter_tel, ter_dir, id))
        conn.commit()
        return doctorInput
Beispiel #2
0
    def post(self):
        """Agregar un nuevo Doctor"""

        doctorInput = request.get_json(force=True)
        ter_nombre = doctorInput['ter_nombre']
        ter_apellido = doctorInput['ter_apellido']
        ter_tel = doctorInput['ter_tel']
        ter_dir = doctorInput['ter_dir']
        doctorInput['ter_id'] = conn.execute(
            '''INSERT INTO terapistas(ter_nombre,ter_apellido,ter_tel,ter_dir)
            VALUES(?,?,?,?)''',
            (ter_nombre, ter_apellido, ter_tel, ter_dir)).lastrowid
        conn.commit()
        return doctorInput
    def put(self, id):
        """Api que actualiza un paciente por su id"""

        patientInput = request.get_json(force=True)
        pac_nombre = patientInput['pac_nombre']
        pac_apellido = patientInput['pac_apellido']
        pac_dni = patientInput['pac_dni']
        pac_tel = patientInput['pac_tel']
        pac_dir = patientInput['pac_dir']
        conn.execute(
            "UPDATE pacientes SET pac_nombre=?,pac_apellido=?,pac_dni=?,pac_tel=?,pac_dir=? WHERE pac_id=?",
            (pac_nombre, pac_apellido, pac_dni, pac_tel, pac_dir, id))
        conn.commit()
        return patientInput
    def post(self):
        """Api para agregar un paciente a la base"""

        patientInput = request.get_json(force=True)
        pac_nombre = patientInput['pac_nombre']
        pac_apellido = patientInput['pac_apellido']
        pac_dni = patientInput['pac_dni']
        pac_tel = patientInput['pac_tel']
        pac_dir = patientInput['pac_dir']
        patientInput['pac_id'] = conn.execute(
            '''INSERT INTO pacientes(pac_nombre,pac_apellido,pac_dni,pac_tel,pac_dir)
            VALUES(?,?,?,?,?)''',
            (pac_nombre, pac_apellido, pac_dni, pac_tel, pac_dir)).lastrowid
        conn.commit()
        return patientInput
Beispiel #5
0
    def delete(self, id):
        """Borra un terapista por ID"""

        conn.execute("DELETE FROM terapistas WHERE ter_id=?", (id, ))
        conn.commit()
        return {'msg': 'sucessfully deleted'}
    def delete(self, id):
        """Api que borra un paciente por su ID"""

        conn.execute("DELETE FROM pacientes WHERE pac_id=?", (id, ))
        conn.commit()
        return {'msg': 'sucessfully deleted'}