コード例 #1
0
def add(current_user, workspaceId, projectId):
    """
        Create Appointments
    """
    if request.content_type == 'application/json':
        post_data = request.get_json()
        app = Appointment(
                participantName=post_data.get('participantName'),
                startDate=post_data.get('startDate'),
                endDate=post_data.get('endDate'),
                participant=post_data.get('participant'),
                appointmentChannel=post_data.get('appointmentChannel'),
                participantPhone=post_data.get('participantPhone'),
                projectId=projectId
                )
        app.create()
        res_payload = {
                'id':app._id,
                'start': app.startDate,
                'end': app.endDate,
                'title': app.participantName,
                'phone': app.participantPhone,
                'email': app.participantEmail,
                'isActive': app.isActive,
                'provider': app.provider,
                'location': app.location,
                'cssClass': 'ACTIVE' if app.isActive else 'DELETED'
            }
        
        return response_with_obj('success', 'Appointment created successfully', res_payload, 200)
    else:
        return response('failed', 'Content-type must be json', 402)
コード例 #2
0
def update(current_user, workspaceId, projectId):
    """
        Update Appointments
    """
    if request.content_type == 'application/json':
        post_data = request.get_json()
        if 'id' not in post_data:
            return response('failed', 'Appointment Id required', 402)
        else:
            app = Appointment.get_by_id(post_data.get('id'))
            if app:
                app.update_appointment(post_data)
                res_payload = {
                    'id':app._id,
                    'start': app.startDate,
                    'end': app.endDate,
                    'title': app.participantName,
                    'phone': app.participantPhone,
                    'email': app.participantEmail,
                    'isActive': app.isActive,
                    'provider': app.provider,
                    'location': app.location,
                    'cssClass': 'ACTIVE' if app.isActive else 'DELETED'
                }
                return response_with_obj('success', 'Appointment updated successfully', res_payload, 200)
            else:
                response('failed', 'Appointment not found', 402)
    else:
        return response('failed', 'Content-type must be json', 402)
コード例 #3
0
ファイル: teachers.py プロジェクト: ksdtech/gae-conferences
 def admin_appointments(self, key):
     item = self.util.decode_key(key).get()
     if not item:
         return 404
     appointments = Appointment.query(ancestor=item.key)
     logging.info("appointments count %d" % appointments.count())
     self.context.set(**{ 'teacher': item, 'appointments': appointments })
コード例 #4
0
def create(db: Session, appointment_in: AppointmentCreate,
           user: User) -> Appointment:
    appointment_in_data = jsonable_encoder(appointment_in)
    db_appointment = Appointment(**appointment_in_data, user_id=user.id)

    db.add(db_appointment)
    db.commit()
    db.refresh(db_appointment)

    return db_appointment
コード例 #5
0
def get(current_user, workspaceId, projectId):
    """
        Get Appointments
    """
    start = request.args.get('start')
    end = request.args.get('end')

    if start == None or end == None:
        return response('failed', 'Start and End Timestamp required.', 402)
    else:
        appointment_list = Appointment.get_appointments(start, end, projectId)
        return {"appointments":appointment_list}
コード例 #6
0
    def post(self):
        parser = reqparse.RequestParser()
        # TODO: Change service provider id to public user id as we will be receiving public id of user. and then fetch there id from db.
        parser.add_argument('service_provider_id', type=str)
        parser.add_argument('patient_id', type=str)

        args = parser.parse_args()
        s_p_id = args["service_provider_id"]
        p_id = args["patient_id"]
        db.session.add(
            AppointmentDetail(datetime.utcnow() + timedelta(days=5, hours=2),
                              Appointment(s_p_id, p_id)))
        db.session.commit()
        return "Appointment created successfully.", 201
コード例 #7
0
ファイル: appointment.py プロジェクト: jynnlow/PDD
    def mockAppointments():
        State.addAppointment(
            Appointment (
                customer_name = "Lee Kah Wei",
                customer_nric = "960411075647",
                dentist = "Dr. Ong",
                treatment = "Fillings",
                date = 20200815,
                timeslot = 1,
                status = "Complated",
                user_id = 4                 
            )
        )

        State.addAppointment(
            Appointment (
                customer_name = "Lee Kah Wei",
                customer_nric = "960411075647",
                dentist = "Dr. Stanley",
                treatment = "Fillings",
                date = 20200823,
                timeslot = 3,
                status = "Pending",
                user_id = 4   
            )
        )

        State.addAppointment(
            Appointment (
                customer_name = "Lee Kah Wei",
                customer_nric = "960411075647",
                dentist = "Dr. Stanley",
                treatment = "Extractions",
                date = 20200820,
                timeslot = 2,
                status = "No-show",
                user_id = 4   
            )
        )

        State.addAppointment(
            Appointment (
                customer_name = "Lee Min Er",
                customer_nric = "9604155689",
                dentist = "Dr. Stanley",
                treatment = "Extractions",
                date = 20200815,
                timeslot = 10,
                status = "Completed",
                user_id = 5
            )
        )

        State.addAppointment(
            Appointment (
                customer_name = "Lee Min Er",
                customer_nric = "9604155689",
                dentist = "Dr. Stanley",
                treatment = "Teeth Cleaning",
                date = 20200824,
                timeslot = 4,
                status = "Pending",
                user_id = 5
            )
        )

        State.addAppointment(
            Appointment (
                customer_name = "Lee Min Er",
                customer_nric = "9604155689",
                dentist = "Dr. Stanley",
                treatment = "Denture",
                date = 20200823,
                timeslot = 7,
                status = "Comfirmed",
                user_id = 5
            )
        )

        State.addAppointment(
            Appointment (
                customer_name = "Tan Yun Ching",
                customer_nric = "964123589646",
                dentist = "Dr. Stanley",
                treatment = "Denture",
                date = 20200815,
                timeslot = 8,
                status = "Completed",
                user_id = 6
            )
        )

        State.addAppointment(
            Appointment (
                customer_name = "Tan Yun Ching",
                customer_nric = "964123589646",
                dentist = "Dr. Ong",
                treatment = "Repairs",
                date = 20200825,
                timeslot = 13,
                status = "Confirmed",
                user_id = 6
            )
        )

        State.addAppointment(
            Appointment (
                customer_name = "Tan Yun Ching",
                customer_nric = "964123589646",
                dentist = "Dr. Ong",
                treatment = "Repairs",
                date = 20200823,
                timeslot = 13,
                status = "Pending",
                user_id = 6
            )
        )

        State.addAppointment(
            Appointment (
                customer_name = "Tan Yun Ching",
                customer_nric = "964123589646",
                dentist = "Dr. Stanley",
                treatment = "Denture",
                date = 20200806,
                timeslot = 13,
                status = "Rejected",
                user_id = 6
            )
        )

        State.addAppointment(
            Appointment (
                customer_name = "Koay Evon",
                customer_nric = "956321458523",
                dentist = "Dr. Ong",
                treatment = "Teeth Cleaning",
                date = 20200806,
                timeslot = 6,
                status = "Completed",
                user_id = 7
            )
        )

        State.addAppointment(
            Appointment (
                customer_name = "Koay Evon",
                customer_nric = "956321458523",
                dentist = "Dr. Stanley",
                treatment = "Teeth Cleaning",
                date = 20200822,
                timeslot = 6,
                status = "Pending",
                user_id = 7
            )
        )

        State.addAppointment(
            Appointment (
                customer_name = "Low Lee Yee",
                customer_nric = "95632555562",
                dentist = "Dr. Ong",
                treatment = "Fillings",
                date = 20200822,
                timeslot = 8,
                status = "Pending",
                user_id = 8
            )
        )

        State.addAppointment(
            Appointment (
                customer_name = "Low Lee Yee",
                customer_nric = "95632555562",
                dentist = "Dr. Ong",
                treatment = "Repairs",
                date = 20200806,
                timeslot = 8,
                status = "Completed",
                user_id = 8
            )
        )