fix: FIFO queue for waitlisting; send email for application form; EU logo in contact page in light mode
This commit is contained in:
@@ -68,26 +68,43 @@ export interface RegistrationSubmission {
|
||||
readonly values: RegistrationValues;
|
||||
/** documentId of the event being registered for. */
|
||||
readonly eventId: string;
|
||||
readonly forwardedFor?: string;
|
||||
}
|
||||
|
||||
export async function submitRegistration(
|
||||
input: RegistrationSubmission,
|
||||
): Promise<void> {
|
||||
await createStrapiEntry(EVENT_REGISTRATIONS_RESOURCE, {
|
||||
event: input.eventId,
|
||||
fullName: input.values.fullName,
|
||||
email: input.values.email,
|
||||
phone: optional(input.values.phone),
|
||||
organisation: optional(input.values.organisation),
|
||||
// Required in the schema: without it every POST is a 400.
|
||||
consentGdpr: input.values.consentGdpr,
|
||||
});
|
||||
): Promise<"confirmed" | "waitlisted"> {
|
||||
const created = await createStrapiEntry<{
|
||||
readonly registrationState?: unknown;
|
||||
}>(
|
||||
EVENT_REGISTRATIONS_RESOURCE,
|
||||
{
|
||||
event: input.eventId,
|
||||
fullName: input.values.fullName,
|
||||
email: input.values.email,
|
||||
phone: optional(input.values.phone),
|
||||
organisation: optional(input.values.organisation),
|
||||
// Required in the schema: without it every POST is a 400.
|
||||
consentGdpr: input.values.consentGdpr,
|
||||
},
|
||||
{ forwardedFor: input.forwardedFor },
|
||||
);
|
||||
|
||||
if (
|
||||
created?.registrationState !== "confirmed" &&
|
||||
created?.registrationState !== "waitlisted"
|
||||
) {
|
||||
throw new Error("Strapi returned an invalid registration state.");
|
||||
}
|
||||
|
||||
return created.registrationState;
|
||||
}
|
||||
|
||||
export interface ApplicationSubmission {
|
||||
readonly values: ApplicationValues;
|
||||
/** documentId of the opportunity being applied to. */
|
||||
readonly opportunityId: string;
|
||||
readonly forwardedFor?: string;
|
||||
}
|
||||
|
||||
/** The key the free-text answer is filed under inside `answers` (json). */
|
||||
@@ -96,17 +113,21 @@ export const APPLICATION_MESSAGE_KEY = "message";
|
||||
export async function submitApplication(
|
||||
input: ApplicationSubmission,
|
||||
): Promise<void> {
|
||||
await createStrapiEntry(APPLICATIONS_RESOURCE, {
|
||||
opportunity: input.opportunityId,
|
||||
// `fullName` is the registration's field name; an application's is
|
||||
// `applicantName`.
|
||||
applicantName: input.values.fullName,
|
||||
email: input.values.email,
|
||||
organisation: optional(input.values.organisation),
|
||||
// `answers` is a json field - the form's one free-text question goes in
|
||||
// it, keyed, so more questions can be added without another migration.
|
||||
answers: { [APPLICATION_MESSAGE_KEY]: input.values.message },
|
||||
});
|
||||
await createStrapiEntry(
|
||||
APPLICATIONS_RESOURCE,
|
||||
{
|
||||
opportunity: input.opportunityId,
|
||||
// `fullName` is the registration's field name; an application's is
|
||||
// `applicantName`.
|
||||
applicantName: input.values.fullName,
|
||||
email: input.values.email,
|
||||
organisation: optional(input.values.organisation),
|
||||
// `answers` is a json field - the form's one free-text question goes in
|
||||
// it, keyed, so more questions can be added without another migration.
|
||||
answers: { [APPLICATION_MESSAGE_KEY]: input.values.message },
|
||||
},
|
||||
{ forwardedFor: input.forwardedFor },
|
||||
);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
@@ -134,6 +155,7 @@ export const APPLICATION_ANSWER_KEYS = {
|
||||
|
||||
export interface PathwayApplicationSubmission {
|
||||
readonly values: PathwayApplicationValues;
|
||||
readonly forwardedFor?: string;
|
||||
/**
|
||||
* documentId of the opportunity this application belongs to, when one is
|
||||
* known. The Get Involved form is NOT tied to a single call - it is the
|
||||
@@ -159,22 +181,26 @@ export async function submitPathwayApplication(
|
||||
): Promise<void> {
|
||||
const { values } = input;
|
||||
|
||||
await createStrapiEntry(APPLICATIONS_RESOURCE, {
|
||||
...(input.opportunityId ? { opportunity: input.opportunityId } : {}),
|
||||
applicantName: values.fullName,
|
||||
email: values.email,
|
||||
organisation: optional(values.organisation),
|
||||
answers: {
|
||||
[APPLICATION_ANSWER_KEYS.route]: values.route,
|
||||
// Only the answers actually given: an empty string in the admin panel
|
||||
// reads as "answered, with nothing", which is not what happened.
|
||||
...(values.region
|
||||
? { [APPLICATION_ANSWER_KEYS.region]: values.region }
|
||||
: {}),
|
||||
...(values.yearsOperating
|
||||
? { [APPLICATION_ANSWER_KEYS.yearsOperating]: values.yearsOperating }
|
||||
: {}),
|
||||
[APPLICATION_ANSWER_KEYS.summary]: values.summary,
|
||||
await createStrapiEntry(
|
||||
APPLICATIONS_RESOURCE,
|
||||
{
|
||||
...(input.opportunityId ? { opportunity: input.opportunityId } : {}),
|
||||
applicantName: values.fullName,
|
||||
email: values.email,
|
||||
organisation: optional(values.organisation),
|
||||
answers: {
|
||||
[APPLICATION_ANSWER_KEYS.route]: values.route,
|
||||
// Only the answers actually given: an empty string in the admin panel
|
||||
// reads as "answered, with nothing", which is not what happened.
|
||||
...(values.region
|
||||
? { [APPLICATION_ANSWER_KEYS.region]: values.region }
|
||||
: {}),
|
||||
...(values.yearsOperating
|
||||
? { [APPLICATION_ANSWER_KEYS.yearsOperating]: values.yearsOperating }
|
||||
: {}),
|
||||
[APPLICATION_ANSWER_KEYS.summary]: values.summary,
|
||||
},
|
||||
},
|
||||
});
|
||||
{ forwardedFor: input.forwardedFor },
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user