Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add generate link to book appointment #390

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

yedidya03
Copy link
Collaborator

No description provided.

@@ -146,3 +148,11 @@ export function validateBookAppointment(
appointment: appointmentToBook,
};
}

function generateRandom(complexity: number = 4) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use a library to generate UIDs?

(await request.get()) as FirebaseFirestore.QuerySnapshot<DbAppointment>;

const ret = toDbAppointments(appointments);
if (ret.length > 1) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See previous comment.

throw Error("there is more then one appointment with this share link!");
}

if (ret.length == 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See previous comment.

request: FunctionsApi.GetSharedLinkAppointmentRequest,
callerId: string
): Promise<FunctionsApi.GetSharedLinkAppointmentResponse> {
if (callerId !== request.donorId) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this API be called by an unregistered user?

packages/common/src/types.ts Show resolved Hide resolved

const appointment = (await callTarget()).appointment;

expect(appointment).not.toBeNaN();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean to test "not to be undefined"?

).rejects.toThrow(Error);
});

test("Returns available appointments is ascending start time order", async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand the test title.

return appointment;
}

test("Not authenticated", async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per previous, this should not stop users from accessing the API.

await setAppointment(appointment);
return appointment;
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the logic test cases,
as written in getAppointmentByShareLink?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants