Skip to content

Commit

Permalink
Remove all covid related features
Browse files Browse the repository at this point in the history
  • Loading branch information
ikusteu committed Jul 6, 2023
1 parent 1103e37 commit 96df44b
Show file tree
Hide file tree
Showing 23 changed files with 6 additions and 187 deletions.
2 changes: 0 additions & 2 deletions packages/client/src/__tests__/cloudFunctions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,6 @@ describe("Cloud functions", () => {
surname: saul.surname,
email: saul.email,
certificateExpiration: saul.certificateExpiration,
covidCertificateReleaseDate: saul.covidCertificateReleaseDate,
covidCertificateSuspended: saul.covidCertificateSuspended,
};
testWithEmulator(
"should create a new customer with data passed in as well as bookings entry",
Expand Down
41 changes: 0 additions & 41 deletions packages/client/src/__tests__/firestoreRules.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -647,27 +647,6 @@ describe("Firestore rules", () => {
);
}
);
testWithEmulator(
"should not allow create/update if 'covidCertificateReleaseDate' provided, but not a valid date",
async () => {
const { db, organization } = await getTestEnv({});
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { covidCertificateReleaseDate, ...noCovidSaul } = saul;
await assertFails(
setDoc(doc(db, getCustomerDocPath(organization, saul.id)), {
...saul,
covidCertificateReleaseDate: "2022-22-24",
})
);
// should allow if (optional) `covidCertificateReleaseDate` is not provided
await assertSucceeds(
setDoc(
doc(db, getCustomerDocPath(organization, saul.id)),
noCovidSaul
)
);
}
);
testWithEmulator(
"should not allow create/update if 'certificateExpiration' provided, but not a valid date",
async () => {
Expand Down Expand Up @@ -834,26 +813,6 @@ describe("Firestore rules", () => {
);
}
);
testWithEmulator(
"should not allow create/update if 'covidCertificateSuspended' provided, but not boolean",
async () => {
const { db, organization } = await getTestEnv({});
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { covidCertificateSuspended, ...noSuspendedSaul } = saul;
await assertFails(
setDoc(doc(db, getCustomerDocPath(organization, saul.id)), {
...saul,
covidCertificateSuspended: "not-a-boolean",
})
);
await assertSucceeds(
setDoc(
doc(db, getCustomerDocPath(organization, saul.id)),
noSuspendedSaul
)
);
}
);
testWithEmulator("should allow `extendedDate` update", async () => {
const { db, organization } = await getTestEnv({
setup: (db, { organization }) =>
Expand Down
2 changes: 0 additions & 2 deletions packages/client/src/lib/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ export const defaultCustomerFormValues: Omit<CustomerFull, "secretKey" | "id"> =
birthday: "",
categories: [],
certificateExpiration: "",
covidCertificateReleaseDate: "",
covidCertificateSuspended: false,
subscriptionNumber: "",
};

Expand Down
8 changes: 0 additions & 8 deletions packages/e2e/__testData__/customers.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
"email": "[email protected]",
"phone": "+393456777",
"birthday": "2001-03-01",
"covidCertificateReleaseDate": "2021-01-01",
"covidCertificateSuspended": true,
"categories": ["competitive"],
"secretKey": "123445",
"subscriptionNumber": ""
Expand All @@ -24,8 +22,6 @@
"email": "walt@im_the_one_who.knocks",
"phone": "123456777",
"birthday": "2002-03-01",
"covidCertificateReleaseDate": "2021-01-01",
"covidCertificateSuspended": false,
"secretKey": "000001",
"subscriptionNumber": ""
},
Expand All @@ -39,8 +35,6 @@
"email": "[email protected]",
"phone": "123456777",
"birthday": "2001-03-02",
"covidCertificateReleaseDate": "2021-01-01",
"covidCertificateSuspended": false,
"secretKey": "000002",
"subscriptionNumber": ""
},
Expand All @@ -54,8 +48,6 @@
"email": "[email protected]",
"phone": "123456777",
"birthday": "2021-01-01",
"covidCertificateReleaseDate": "2021-01-01",
"covidCertificateSuspended": false,
"secretKey": "000002",
"subscriptionNumber": ""
}
Expand Down
2 changes: 0 additions & 2 deletions packages/e2e/__testData__/saul_with_extended_date.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
"email": "[email protected]",
"phone": "+123456777",
"birthday": "2001-01-01",
"covidCertificateReleaseDate": "2021-01-01",
"covidCertificateSuspended": true,
"categories": ["competitive"],
"secretKey": "123445",
"subscriptionNumber": "41",
Expand Down
3 changes: 0 additions & 3 deletions packages/e2e/integration/athlete_self_register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ describe("Athlete self registration", () => {
.should("have.value", newEmail)
.should("be.disabled");

// We're not filling in the 'certificateExpiration' not 'covidCertificateReleaseDate' as those fields
// should be optional

// The wrong registration code should show as validation error
cy.getAttrWith("name", "registrationCode").type("wrong-code");
cy.clickButton(t(ActionButton.Save));
Expand Down
5 changes: 0 additions & 5 deletions packages/e2e/integration/athlete_self_update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,12 @@ describe("athlete profile", () => {
cy.getAttrWith("name", "certificateExpiration").clearAndType(
saul.certificateExpiration || ""
);
cy.getAttrWith("name", "covidCertificateReleaseDate").clearAndType(
saul.covidCertificateReleaseDate || ""
);
cy.getAttrWith("name", "covidCertificateSuspended").click();
cy.getAttrWith("type", "submit").click();
cy.contains(i18n.t(NotificationMessage.CustomerProfileUpdated) as string);
});

it("allows customer form submission with minimal fields", () => {
cy.getAttrWith("name", "certificateExpiration").clear();
cy.getAttrWith("name", "covidCertificateReleaseDate").clear();

cy.getAttrWith("type", "submit").click();
cy.contains(i18n.t(NotificationMessage.CustomerProfileUpdated) as string);
Expand Down
10 changes: 0 additions & 10 deletions packages/e2e/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,6 @@ export default (): void => {
birthday,
categories,
certificateExpiration,
covidCertificateReleaseDate,
covidCertificateSuspended,
} = customer;

if (name) {
Expand All @@ -165,14 +163,6 @@ export default (): void => {
.eq(1)
.type(certificateExpiration);
}
if (covidCertificateReleaseDate) {
cy.getAttrWith("placeholder", "dd/mm/yyyy")
.eq(2)
.type(covidCertificateReleaseDate);
}
if (covidCertificateSuspended) {
cy.getAttrWith("name", "covidCertificateSuspended").check();
}
});

Cypress.Commands.add("resetCustomerForm", () => {
Expand Down
10 changes: 2 additions & 8 deletions packages/firestore/firestore.rules
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ service cloud.firestore {
// Check optional dates
checkOptionalValidDate(request.resource.data, "birthday") &&
checkOptionalValidDate(request.resource.data, "certificateExpiration") &&
checkOptionalValidDate(request.resource.data, "covidCertificateReleaseDate") &&
// Check category (allows updates even if "adults")
request.resource.data.categories.hasOnly(getAllCategories()) &&
// Check valid email
Expand All @@ -187,9 +186,7 @@ service cloud.firestore {
!("phone" in request.resource.data) ||
request.resource.data.phone == "" ||
checkValidPhoneNumber(request.resource.data.phone)
) &&
// Check release date suspended type
checkOptionalBoolean(request.resource.data, "covidCertificateSuspended")
)
)
allow create: if (
isAdmin(organization) &&
Expand All @@ -199,7 +196,6 @@ service cloud.firestore {
// Check optional dates
checkOptionalValidDate(request.resource.data, "birthday") &&
checkOptionalValidDate(request.resource.data, "certificateExpiration") &&
checkOptionalValidDate(request.resource.data, "covidCertificateReleaseDate") &&
// Check category (shouldn't allow creation with "adults" category)
request.resource.data.categories.hasOnly(getCategories()) &&
// Check valid email
Expand All @@ -213,9 +209,7 @@ service cloud.firestore {
!("phone" in request.resource.data) ||
request.resource.data.phone == "" ||
checkValidPhoneNumber(request.resource.data.phone)
) &&
// Check release date suspended type
checkOptionalBoolean(request.resource.data, "covidCertificateSuspended")
)
)
}
// #region customer-checks
Expand Down
4 changes: 0 additions & 4 deletions packages/functions/src/testData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,6 @@ const createUsers = async (
certificateExpiration: DateTime.local()
.plus({ days: _.random(-40, 200) })
.toISODate(),
covidCertificateReleaseDate: DateTime.local()
.plus({ days: _.random(-500, 0) })
.toISODate(),
covidCertificateSuspended: _.sample([true, false])!,
};

await org
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { DateTime } from "luxon";

import { Category, CustomerFull, luxon2ISODate } from "@eisbuk/shared";
import { Category, CustomerFull } from "@eisbuk/shared";

export const saul: CustomerFull = {
name: "Saul",
Expand All @@ -10,8 +8,6 @@ export const saul: CustomerFull = {
email: "[email protected]",
phone: "+123456777",
birthday: "2001-01-01",
covidCertificateReleaseDate: "2021-01-01",
covidCertificateSuspended: true,
categories: [Category.Competitive],
secretKey: "123445",
subscriptionNumber: "",
Expand All @@ -26,8 +22,6 @@ export const gus: CustomerFull = {
email: "[email protected]",
phone: "+123456777",
birthday: "2001-01-01",
covidCertificateReleaseDate: luxon2ISODate(DateTime.now().plus({ days: 1 })),
covidCertificateSuspended: false,
secretKey: "000002",
subscriptionNumber: "",
};
Expand All @@ -41,8 +35,6 @@ export const jian: CustomerFull = {
email: "[email protected]",
phone: "+123456777",
birthday: "2001-01-01",
covidCertificateReleaseDate: luxon2ISODate(DateTime.now().plus({ days: 1 })),
covidCertificateSuspended: false,
secretKey: "000002",
subscriptionNumber: "",
};
2 changes: 0 additions & 2 deletions packages/shared/src/types/firestore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,6 @@ export interface CustomerBase {
phone?: string;
birthday?: string;
certificateExpiration?: string;
covidCertificateReleaseDate?: string;
covidCertificateSuspended?: boolean;
photoURL?: string;
}
/**
Expand Down
16 changes: 1 addition & 15 deletions packages/testing/src/customers/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { DateTime } from "luxon";

import { Category, CustomerFull, luxon2ISODate } from "@eisbuk/shared";
import { Category, CustomerFull } from "@eisbuk/shared";

export const saul: CustomerFull = {
name: "Saul",
Expand All @@ -12,8 +10,6 @@ export const saul: CustomerFull = {
email: "[email protected]",
phone: "+123456777",
birthday: "2001-01-01",
covidCertificateReleaseDate: "2021-01-01",
covidCertificateSuspended: true,
categories: [Category.Competitive],
secretKey: "123445",
subscriptionNumber: "",
Expand All @@ -30,8 +26,6 @@ export const walt: CustomerFull = {
email: "walt@im_the_one_who.knocks",
phone: "+123456777",
birthday: "2002-01-01",
covidCertificateReleaseDate: "2021-01-01",
covidCertificateSuspended: false,
secretKey: "000001",
subscriptionNumber: "",
};
Expand All @@ -47,8 +41,6 @@ export const gus: CustomerFull = {
email: "[email protected]",
phone: "+123456777",
birthday: "2001-01-01",
covidCertificateReleaseDate: luxon2ISODate(DateTime.now().plus({ days: 1 })),
covidCertificateSuspended: false,
secretKey: "000002",
subscriptionNumber: "",
};
Expand All @@ -64,8 +56,6 @@ export const jian: CustomerFull = {
email: "[email protected]",
phone: "+123456777",
birthday: "2001-01-01",
covidCertificateReleaseDate: luxon2ISODate(DateTime.now().plus({ days: 1 })),
covidCertificateSuspended: false,
secretKey: "000002",
subscriptionNumber: "",
};
Expand All @@ -81,8 +71,6 @@ export const mike: CustomerFull = {
email: "mike@ehrmantraut",
phone: "+123456777",
birthday: "2022-12-27",
covidCertificateReleaseDate: luxon2ISODate(DateTime.now().plus({ days: 1 })),
covidCertificateSuspended: false,
secretKey: "000022",
subscriptionNumber: "",
};
Expand All @@ -96,8 +84,6 @@ export const jane: CustomerFull = {
email: "jane@margolis",
phone: "+123456777",
birthday: "2009-12-23",
covidCertificateReleaseDate: luxon2ISODate(DateTime.now().plus({ days: 1 })),
covidCertificateSuspended: false,
secretKey: "000222",
subscriptionNumber: "",
};
2 changes: 0 additions & 2 deletions packages/translations/src/dict/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@
"DateOfBirth": "Date Of Birth",
"MedicalCertificate": "Medical Certificate Expiration",
"CardNumber": "Card Number",
"CovidCertificateReleaseDate": "Date of release of EU Digital COVID Certificate",
"CovidCertificateSuspended": "COVID-19 Certificate suspended",
"ExtendedBookingDate": "Extended booking date",
"MedicalDetails": "Medical Details",
"ManageMedicalDetails": "Manage your medical details",
Expand Down
2 changes: 0 additions & 2 deletions packages/translations/src/dict/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,6 @@
"DateOfBirth": "Data di nascita",
"MedicalCertificate": "Scadenza Cert. Medico",
"CardNumber": "Numero Tessera",
"CovidCertificateReleaseDate": "Data di rilascio della Certificazione verde COVID-19",
"CovidCertificateSuspended": "Certificazione verde sospesa",
"ExtendedBookingDate": "Estendi scadenza prenotazioni",
"MedicalDetails": "Dettagli Medici",
"ManageMedicalDetails": "Gestisci i tuoi dettagli medici",
Expand Down
2 changes: 0 additions & 2 deletions packages/translations/src/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,6 @@ export enum CustomerLabel {
Birthday = "CustomerLabel.DateOfBirth",
CertificateExpiration = "CustomerLabel.MedicalCertificate",
CardNumber = "CustomerLabel.CardNumber",
CovidCertificateReleaseDate = "CustomerLabel.CovidCertificateReleaseDate",
CovidCertificateSuspended = "CustomerLabel.CovidCertificateSuspended",
ExtendedBookingDate = "CustomerLabel.ExtendedBookingDate",
MedicalDetails = "CustomerLabel.MedicalDetails",
ManageMedicalDetails = "CustomerLabel.ManageMedicalDetails",
Expand Down
2 changes: 0 additions & 2 deletions packages/ui/src/Forms/CustomerForm/CustomerForm.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ const customer = {
phone: "+44 78930 788900",
birthday: "2012-12-12",
certificateExpiration: "2021-19-03",
covidCertificateReleaseDate: "",
covidCertificateSuspended: true,
subscriptionNumber: "123456",
extendedDate: "2022-01-01",
};
Expand Down
Loading

0 comments on commit 96df44b

Please sign in to comment.