diff --git a/packages/client/src/__tests__/cloudFunctions.test.ts b/packages/client/src/__tests__/cloudFunctions.test.ts index bebf87b40..0062de185 100644 --- a/packages/client/src/__tests__/cloudFunctions.test.ts +++ b/packages/client/src/__tests__/cloudFunctions.test.ts @@ -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", diff --git a/packages/client/src/__tests__/firestoreRules.test.ts b/packages/client/src/__tests__/firestoreRules.test.ts index 7e0cd889a..d72737f74 100644 --- a/packages/client/src/__tests__/firestoreRules.test.ts +++ b/packages/client/src/__tests__/firestoreRules.test.ts @@ -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 () => { @@ -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 }) => diff --git a/packages/client/src/lib/data.ts b/packages/client/src/lib/data.ts index 760e1c263..2541aa77b 100644 --- a/packages/client/src/lib/data.ts +++ b/packages/client/src/lib/data.ts @@ -36,8 +36,6 @@ export const defaultCustomerFormValues: Omit = birthday: "", categories: [], certificateExpiration: "", - covidCertificateReleaseDate: "", - covidCertificateSuspended: false, subscriptionNumber: "", }; diff --git a/packages/e2e/__testData__/customers.json b/packages/e2e/__testData__/customers.json index d171bba81..db0bab77e 100644 --- a/packages/e2e/__testData__/customers.json +++ b/packages/e2e/__testData__/customers.json @@ -8,8 +8,6 @@ "email": "saul@better.call", "phone": "+393456777", "birthday": "2001-03-01", - "covidCertificateReleaseDate": "2021-01-01", - "covidCertificateSuspended": true, "categories": ["competitive"], "secretKey": "123445", "subscriptionNumber": "" @@ -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": "" }, @@ -39,8 +35,6 @@ "email": "gus@lospollos.me", "phone": "123456777", "birthday": "2001-03-02", - "covidCertificateReleaseDate": "2021-01-01", - "covidCertificateSuspended": false, "secretKey": "000002", "subscriptionNumber": "" }, @@ -54,8 +48,6 @@ "email": "mike@lospollos.me", "phone": "123456777", "birthday": "2021-01-01", - "covidCertificateReleaseDate": "2021-01-01", - "covidCertificateSuspended": false, "secretKey": "000002", "subscriptionNumber": "" } diff --git a/packages/e2e/__testData__/saul_with_extended_date.json b/packages/e2e/__testData__/saul_with_extended_date.json index 2f463cfab..5362b601b 100644 --- a/packages/e2e/__testData__/saul_with_extended_date.json +++ b/packages/e2e/__testData__/saul_with_extended_date.json @@ -8,8 +8,6 @@ "email": "saul@better.call", "phone": "+123456777", "birthday": "2001-01-01", - "covidCertificateReleaseDate": "2021-01-01", - "covidCertificateSuspended": true, "categories": ["competitive"], "secretKey": "123445", "subscriptionNumber": "41", diff --git a/packages/e2e/integration/athlete_self_register.ts b/packages/e2e/integration/athlete_self_register.ts index 24fd5d9c7..39ff3446e 100644 --- a/packages/e2e/integration/athlete_self_register.ts +++ b/packages/e2e/integration/athlete_self_register.ts @@ -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)); diff --git a/packages/e2e/integration/athlete_self_update.ts b/packages/e2e/integration/athlete_self_update.ts index 52426d5d9..d01b13a47 100644 --- a/packages/e2e/integration/athlete_self_update.ts +++ b/packages/e2e/integration/athlete_self_update.ts @@ -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); diff --git a/packages/e2e/support/commands.ts b/packages/e2e/support/commands.ts index 69bbfa3d6..89f777152 100644 --- a/packages/e2e/support/commands.ts +++ b/packages/e2e/support/commands.ts @@ -138,8 +138,6 @@ export default (): void => { birthday, categories, certificateExpiration, - covidCertificateReleaseDate, - covidCertificateSuspended, } = customer; if (name) { @@ -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", () => { diff --git a/packages/firestore/firestore.rules b/packages/firestore/firestore.rules index 07aff2027..f3c325592 100644 --- a/packages/firestore/firestore.rules +++ b/packages/firestore/firestore.rules @@ -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 @@ -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) && @@ -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 @@ -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 diff --git a/packages/functions/src/testData.ts b/packages/functions/src/testData.ts index 00e263047..b360ef2c9 100644 --- a/packages/functions/src/testData.ts +++ b/packages/functions/src/testData.ts @@ -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 diff --git a/packages/react-redux-firebase-firestore/src/__testData__/customers.ts b/packages/react-redux-firebase-firestore/src/__testData__/customers.ts index 2342fb94b..9d0f45fa8 100644 --- a/packages/react-redux-firebase-firestore/src/__testData__/customers.ts +++ b/packages/react-redux-firebase-firestore/src/__testData__/customers.ts @@ -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", @@ -10,8 +8,6 @@ export const saul: CustomerFull = { email: "saul@gmail.com", phone: "+123456777", birthday: "2001-01-01", - covidCertificateReleaseDate: "2021-01-01", - covidCertificateSuspended: true, categories: [Category.Competitive], secretKey: "123445", subscriptionNumber: "", @@ -26,8 +22,6 @@ export const gus: CustomerFull = { email: "gus@lospollos.me", phone: "+123456777", birthday: "2001-01-01", - covidCertificateReleaseDate: luxon2ISODate(DateTime.now().plus({ days: 1 })), - covidCertificateSuspended: false, secretKey: "000002", subscriptionNumber: "", }; @@ -41,8 +35,6 @@ export const jian: CustomerFull = { email: "mike.hunt@isyourrefrigeratorrunning.me", phone: "+123456777", birthday: "2001-01-01", - covidCertificateReleaseDate: luxon2ISODate(DateTime.now().plus({ days: 1 })), - covidCertificateSuspended: false, secretKey: "000002", subscriptionNumber: "", }; diff --git a/packages/shared/src/types/firestore.ts b/packages/shared/src/types/firestore.ts index 3bc9bb8be..75aacc15c 100644 --- a/packages/shared/src/types/firestore.ts +++ b/packages/shared/src/types/firestore.ts @@ -209,8 +209,6 @@ export interface CustomerBase { phone?: string; birthday?: string; certificateExpiration?: string; - covidCertificateReleaseDate?: string; - covidCertificateSuspended?: boolean; photoURL?: string; } /** diff --git a/packages/testing/src/customers/index.ts b/packages/testing/src/customers/index.ts index 4802e2c6e..e29b89cc8 100644 --- a/packages/testing/src/customers/index.ts +++ b/packages/testing/src/customers/index.ts @@ -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", @@ -12,8 +10,6 @@ export const saul: CustomerFull = { email: "saul@gmail.com", phone: "+123456777", birthday: "2001-01-01", - covidCertificateReleaseDate: "2021-01-01", - covidCertificateSuspended: true, categories: [Category.Competitive], secretKey: "123445", subscriptionNumber: "", @@ -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: "", }; @@ -47,8 +41,6 @@ export const gus: CustomerFull = { email: "gus@lospollos.me", phone: "+123456777", birthday: "2001-01-01", - covidCertificateReleaseDate: luxon2ISODate(DateTime.now().plus({ days: 1 })), - covidCertificateSuspended: false, secretKey: "000002", subscriptionNumber: "", }; @@ -64,8 +56,6 @@ export const jian: CustomerFull = { email: "mike.hunt@isyourrefrigeratorrunning.me", phone: "+123456777", birthday: "2001-01-01", - covidCertificateReleaseDate: luxon2ISODate(DateTime.now().plus({ days: 1 })), - covidCertificateSuspended: false, secretKey: "000002", subscriptionNumber: "", }; @@ -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: "", }; @@ -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: "", }; diff --git a/packages/translations/src/dict/en.json b/packages/translations/src/dict/en.json index fa393a084..f691a22b0 100644 --- a/packages/translations/src/dict/en.json +++ b/packages/translations/src/dict/en.json @@ -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", diff --git a/packages/translations/src/dict/it.json b/packages/translations/src/dict/it.json index 43e0c695e..a28754f4a 100644 --- a/packages/translations/src/dict/it.json +++ b/packages/translations/src/dict/it.json @@ -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", diff --git a/packages/translations/src/translations.ts b/packages/translations/src/translations.ts index 6cf2e4131..a898cc3e3 100644 --- a/packages/translations/src/translations.ts +++ b/packages/translations/src/translations.ts @@ -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", diff --git a/packages/ui/src/Forms/CustomerForm/CustomerForm.stories.tsx b/packages/ui/src/Forms/CustomerForm/CustomerForm.stories.tsx index 7dfda3c99..410c00c88 100644 --- a/packages/ui/src/Forms/CustomerForm/CustomerForm.stories.tsx +++ b/packages/ui/src/Forms/CustomerForm/CustomerForm.stories.tsx @@ -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", }; diff --git a/packages/ui/src/Forms/CustomerForm/SectionMedicalDetails.tsx b/packages/ui/src/Forms/CustomerForm/SectionMedicalDetails.tsx index e49041e93..95b5d94c6 100644 --- a/packages/ui/src/Forms/CustomerForm/SectionMedicalDetails.tsx +++ b/packages/ui/src/Forms/CustomerForm/SectionMedicalDetails.tsx @@ -7,7 +7,7 @@ import i18n, { CustomerLabel, ValidationMessage, } from "@eisbuk/translations"; -import { ShieldCheck, ClipboardList } from "@eisbuk/svg"; +import { ClipboardList } from "@eisbuk/svg"; import FormSection from "../FormSection"; import FormField, { FormFieldVariant, FormFieldWitdh } from "../FormField"; @@ -16,8 +16,6 @@ import { isISODay } from "../../utils/date"; export interface MedicalDetailsFields { certificateExpiration: string; - covidCertificateReleaseDate: string; - covidCertificateSuspended: boolean; } interface SectionProps { @@ -41,30 +39,12 @@ const SectionMedicalDetails: React.FC = (contextProps) => { label={t(CustomerLabel.CertificateExpiration)} Icon={ClipboardList} /> - - - - ); }; export const medicalDetailsInitialValues: MedicalDetailsFields = { certificateExpiration: "", - covidCertificateReleaseDate: "", - covidCertificateSuspended: false, }; export const medicalDetailsValidations: ObjectShape = { @@ -72,11 +52,6 @@ export const medicalDetailsValidations: ObjectShape = { test: (input) => !input || isISODay(input), message: i18n.t(ValidationMessage.InvalidDate), }), - covidCertificateReleaseDate: Yup.string().test({ - test: (input) => !input || isISODay(input), - message: i18n.t(ValidationMessage.InvalidDate), - }), - covidCertificateSuspended: Yup.boolean(), }; export default SectionMedicalDetails; diff --git a/packages/ui/src/Forms/CustomerForm/__testData__/index.ts b/packages/ui/src/Forms/CustomerForm/__testData__/index.ts index 8a49454bc..08bcd854c 100644 --- a/packages/ui/src/Forms/CustomerForm/__testData__/index.ts +++ b/packages/ui/src/Forms/CustomerForm/__testData__/index.ts @@ -8,8 +8,6 @@ export const saul: CustomerFull = { email: "saul@gmail.com", phone: "+123456777", birthday: "2001-01-01", - covidCertificateReleaseDate: "2021-01-01", - covidCertificateSuspended: true, categories: [Category.Competitive], secretKey: "123445", subscriptionNumber: "", diff --git a/packages/ui/src/Forms/CustomerForm/__tests__/FormAdmin.test.tsx b/packages/ui/src/Forms/CustomerForm/__tests__/FormAdmin.test.tsx index 333583b2e..5ec2e7b18 100644 --- a/packages/ui/src/Forms/CustomerForm/__tests__/FormAdmin.test.tsx +++ b/packages/ui/src/Forms/CustomerForm/__tests__/FormAdmin.test.tsx @@ -64,8 +64,6 @@ describe("CustomerForm", () => { // Medical fields t(CustomerLabel.CertificateExpiration), - t(CustomerLabel.CovidCertificateReleaseDate), - t(CustomerLabel.CovidCertificateSuspended), // Admin fields t(CustomerLabel.CardNumber), @@ -362,8 +360,6 @@ describe("CustomerForm", () => { // Medical fields t(CustomerLabel.CertificateExpiration), - t(CustomerLabel.CovidCertificateReleaseDate), - t(CustomerLabel.CovidCertificateSuspended), // Admin fields t(CustomerLabel.CardNumber), diff --git a/packages/ui/src/Forms/CustomerForm/__tests__/FormProfile.test.tsx b/packages/ui/src/Forms/CustomerForm/__tests__/FormProfile.test.tsx index cc1d1ebdb..deec938cc 100644 --- a/packages/ui/src/Forms/CustomerForm/__tests__/FormProfile.test.tsx +++ b/packages/ui/src/Forms/CustomerForm/__tests__/FormProfile.test.tsx @@ -23,8 +23,6 @@ describe("CustomerForm", () => { // Medical fields i18n.t(CustomerLabel.CertificateExpiration), - i18n.t(CustomerLabel.CovidCertificateReleaseDate), - i18n.t(CustomerLabel.CovidCertificateSuspended), ] as string[]; // Fields should be disabled as we're not in edit mode diff --git a/packages/ui/src/Forms/CustomerForm/__tests__/FormSelfReg.test.tsx b/packages/ui/src/Forms/CustomerForm/__tests__/FormSelfReg.test.tsx index 31bade6ae..7f3bc8486 100644 --- a/packages/ui/src/Forms/CustomerForm/__tests__/FormSelfReg.test.tsx +++ b/packages/ui/src/Forms/CustomerForm/__tests__/FormSelfReg.test.tsx @@ -28,8 +28,6 @@ describe("CustomerForm", () => { // Medical fields i18n.t(CustomerLabel.CertificateExpiration), - i18n.t(CustomerLabel.CovidCertificateReleaseDate), - i18n.t(CustomerLabel.CovidCertificateSuspended), ] as string[]; // All (standard) fields should be enabled diff --git a/packages/ui/src/UserAvatar/CustomerAvatar.tsx b/packages/ui/src/UserAvatar/CustomerAvatar.tsx index 3961c32ed..cb6b55950 100644 --- a/packages/ui/src/UserAvatar/CustomerAvatar.tsx +++ b/packages/ui/src/UserAvatar/CustomerAvatar.tsx @@ -17,24 +17,13 @@ export const CustomerAvatar: React.FC = ({ customer, ...props }) => { - const { - photoURL, - certificateExpiration, - covidCertificateReleaseDate, - covidCertificateSuspended, - } = customer; + const { photoURL, certificateExpiration } = customer; const [badges, setBadges] = useState([]); useEffect(() => { const badges = []; - const covidCertBadge = getCovidCertBadge( - covidCertificateSuspended, - covidCertificateReleaseDate - ); - if (covidCertBadge) badges.push(covidCertBadge); - const medCertBadge = getMedCertBadge(certificateExpiration); if (medCertBadge) badges.push(medCertBadge); @@ -133,23 +122,3 @@ const getMedCertBadge = (certificateExpiration?: string): Badge | undefined => { ? { color: "bg-yellow-200 text-red-500 border border-red-500", Icon } : undefined; }; - -const getCovidCertBadge = ( - covidCertificateSuspended = true, - covidCertificateReleaseDate?: string -): Badge | undefined => { - // get covid certificate data - const luxonCovidCertDate = DateTime.fromISO( - covidCertificateReleaseDate || "" - ); - // elapsed days from covid certificate release date, fallback is -1: customer dosan't have a covid certificate (yet) - const daysFromCovidCert = -luxonCovidCertDate.diffNow("days")?.days || -1; - - const Icon = () => C; - - return daysFromCovidCert > 365 // Covid certificate expires in one year - ? { color: "bg-red-400 text-white border border-green-500", Icon } - : covidCertificateSuspended - ? { color: "bg-blue-300 text-white border border-green-500", Icon } - : undefined; -};