generated from nhcarrigan/template
Compare commits
No commits in common. "main" and "v1.0.0" have entirely different histories.
@ -1,34 +0,0 @@
|
|||||||
name: Code Analysis
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
sonar:
|
|
||||||
name: SonarQube
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout Source Files
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: SonarCube Scan
|
|
||||||
uses: SonarSource/sonarqube-scan-action@v4
|
|
||||||
timeout-minutes: 10
|
|
||||||
env:
|
|
||||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
||||||
SONAR_HOST_URL: "https://quality.nhcarrigan.com"
|
|
||||||
with:
|
|
||||||
args: >
|
|
||||||
-Dsonar.sources=.
|
|
||||||
-Dsonar.projectKey=forms
|
|
||||||
|
|
||||||
- name: SonarQube Quality Gate check
|
|
||||||
uses: sonarsource/sonarqube-quality-gate-action@v1
|
|
||||||
with:
|
|
||||||
pollingTimeoutSec: 600
|
|
||||||
env:
|
|
||||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
||||||
SONAR_HOST_URL: "https://quality.nhcarrigan.com"
|
|
@ -16,7 +16,6 @@ import type {
|
|||||||
SuccessResponse,
|
SuccessResponse,
|
||||||
Staff,
|
Staff,
|
||||||
DataResponse,
|
DataResponse,
|
||||||
Testimonial,
|
|
||||||
} from "@repo/types";
|
} from "@repo/types";
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
@ -143,20 +142,6 @@ export class ApiService {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async submitTestimonial(
|
|
||||||
testimonial: Partial<Testimonial>,
|
|
||||||
): Promise<SuccessResponse | ErrorResponse> {
|
|
||||||
const request = await fetch(`${this.url}/submit/testimonials`, {
|
|
||||||
body: JSON.stringify(testimonial),
|
|
||||||
headers: {
|
|
||||||
"Content-type": "application/json",
|
|
||||||
},
|
|
||||||
method: "POST",
|
|
||||||
});
|
|
||||||
const response = await request.json() as SuccessResponse | ErrorResponse;
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async getData(
|
public async getData(
|
||||||
type:
|
type:
|
||||||
| "appeals"
|
| "appeals"
|
||||||
@ -165,8 +150,7 @@ export class ApiService {
|
|||||||
| "events"
|
| "events"
|
||||||
| "meetings"
|
| "meetings"
|
||||||
| "mentorships"
|
| "mentorships"
|
||||||
| "staff"
|
| "staff",
|
||||||
| "testimonials",
|
|
||||||
token: string,
|
token: string,
|
||||||
): Promise<DataResponse | ErrorResponse> {
|
): Promise<DataResponse | ErrorResponse> {
|
||||||
const request = await fetch(`${this.url}/list/${type}`, {
|
const request = await fetch(`${this.url}/list/${type}`, {
|
||||||
@ -188,8 +172,7 @@ export class ApiService {
|
|||||||
| "events"
|
| "events"
|
||||||
| "meetings"
|
| "meetings"
|
||||||
| "mentorships"
|
| "mentorships"
|
||||||
| "staff"
|
| "staff",
|
||||||
| "testimonials",
|
|
||||||
id: string,
|
id: string,
|
||||||
token: string,
|
token: string,
|
||||||
): Promise<SuccessResponse | ErrorResponse> {
|
): Promise<SuccessResponse | ErrorResponse> {
|
||||||
|
@ -13,8 +13,6 @@ import { MeetingComponent } from "./forms/meeting/meeting.component.js";
|
|||||||
import { MentorshipComponent }
|
import { MentorshipComponent }
|
||||||
from "./forms/mentorship/mentorship.component.js";
|
from "./forms/mentorship/mentorship.component.js";
|
||||||
import { StaffComponent } from "./forms/staff/staff.component.js";
|
import { StaffComponent } from "./forms/staff/staff.component.js";
|
||||||
import { TestimonialComponent }
|
|
||||||
from "./forms/testimonial/testimonial.component.js";
|
|
||||||
import { HomeComponent } from "./home/home.component.js";
|
import { HomeComponent } from "./home/home.component.js";
|
||||||
import { ReviewComponent } from "./review/review.component.js";
|
import { ReviewComponent } from "./review/review.component.js";
|
||||||
import type { Routes } from "@angular/router";
|
import type { Routes } from "@angular/router";
|
||||||
@ -29,5 +27,4 @@ export const routes: Routes = [
|
|||||||
{ component: MentorshipComponent, path: "mentorship" },
|
{ component: MentorshipComponent, path: "mentorship" },
|
||||||
{ component: StaffComponent, path: "staff" },
|
{ component: StaffComponent, path: "staff" },
|
||||||
{ component: ReviewComponent, path: "review" },
|
{ component: ReviewComponent, path: "review" },
|
||||||
{ component: TestimonialComponent, path: "testimonial" },
|
|
||||||
];
|
];
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
<h1>Testimonials</h1>
|
|
||||||
<p>This form allows past clients and colleagues to submit reviews reflecting their positive experience with our work.</p>
|
|
||||||
<p>We will respond to these submissions when your testimonial is <a href="https://testimonials.nhcarrigan.com" target="_blank">on our site</a>.</p>
|
|
||||||
<app-error *ngIf="error" error="{{ error }}"></app-error>
|
|
||||||
<app-success *ngIf="success"></app-success>
|
|
||||||
<form *ngIf="!loading">
|
|
||||||
<app-userinfo [firstNameControl]="firstName" [lastNameControl]="lastName" [emailControl]="email" [companyControl]="company"></app-userinfo>
|
|
||||||
<app-multi-line label="Share your experience working with us!" [control]="content"></app-multi-line>
|
|
||||||
<app-consent [control]="consent"></app-consent>
|
|
||||||
<button type="button" (click)="submit($event)">Submit</button>
|
|
||||||
</form>
|
|
||||||
<a routerLink="/">Back to home</a>
|
|
@ -1,80 +0,0 @@
|
|||||||
/**
|
|
||||||
* @copyright nhcarrigan
|
|
||||||
* @license Naomi's Public License
|
|
||||||
* @author Naomi Carrigan
|
|
||||||
*/
|
|
||||||
import { CommonModule } from "@angular/common";
|
|
||||||
import { Component } from "@angular/core";
|
|
||||||
import { FormControl, ReactiveFormsModule } from "@angular/forms";
|
|
||||||
import { RouterModule } from "@angular/router";
|
|
||||||
import { ApiService } from "../../api.service.js";
|
|
||||||
import { ConsentComponent } from "../../consent/consent.component.js";
|
|
||||||
import { ErrorComponent } from "../../error/error.component.js";
|
|
||||||
import { MultiLineComponent }
|
|
||||||
from "../../inputs/multi-line/multi-line.component.js";
|
|
||||||
import { SuccessComponent } from "../../success/success.component.js";
|
|
||||||
import { UserinfoComponent } from "../../userinfo/userinfo.component.js";
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
imports: [
|
|
||||||
RouterModule,
|
|
||||||
CommonModule,
|
|
||||||
ConsentComponent,
|
|
||||||
UserinfoComponent,
|
|
||||||
ErrorComponent,
|
|
||||||
ReactiveFormsModule,
|
|
||||||
MultiLineComponent,
|
|
||||||
SuccessComponent,
|
|
||||||
],
|
|
||||||
selector: "app-testimonial",
|
|
||||||
styleUrl: "./testimonial.component.css",
|
|
||||||
templateUrl: "./testimonial.component.html",
|
|
||||||
})
|
|
||||||
export class TestimonialComponent {
|
|
||||||
public loading = false;
|
|
||||||
public error = "";
|
|
||||||
public success = false;
|
|
||||||
|
|
||||||
public firstName = new FormControl("");
|
|
||||||
public lastName = new FormControl("");
|
|
||||||
public email = new FormControl("");
|
|
||||||
public company = new FormControl("");
|
|
||||||
|
|
||||||
public content = new FormControl("");
|
|
||||||
|
|
||||||
public consent = new FormControl(false);
|
|
||||||
|
|
||||||
public constructor(private readonly apiService: ApiService) {}
|
|
||||||
|
|
||||||
public submit(event: MouseEvent): void {
|
|
||||||
this.error = "";
|
|
||||||
const { form } = event.target as HTMLButtonElement;
|
|
||||||
const valid = form?.reportValidity();
|
|
||||||
if (valid !== true) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.loading = true;
|
|
||||||
|
|
||||||
this.apiService.
|
|
||||||
submitTestimonial({
|
|
||||||
consent: this.consent.value ?? false,
|
|
||||||
content: this.content.value ?? undefined,
|
|
||||||
email: this.email.value ?? undefined,
|
|
||||||
firstName: this.firstName.value ?? undefined,
|
|
||||||
lastName: this.lastName.value ?? undefined,
|
|
||||||
}).
|
|
||||||
then((response) => {
|
|
||||||
if ("error" in response) {
|
|
||||||
this.error = response.error;
|
|
||||||
this.loading = false;
|
|
||||||
} else {
|
|
||||||
this.error = "";
|
|
||||||
this.success = true;
|
|
||||||
}
|
|
||||||
}).
|
|
||||||
catch(() => {
|
|
||||||
this.error = "An error occurred while submitting the form.";
|
|
||||||
this.loading = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -29,6 +29,3 @@
|
|||||||
<a routerLink="/mentorship">
|
<a routerLink="/mentorship">
|
||||||
<i class="fa-solid fa-brain" aria-hidden="true"></i> Mentorship Programme
|
<i class="fa-solid fa-brain" aria-hidden="true"></i> Mentorship Programme
|
||||||
</a>
|
</a>
|
||||||
<a routerLink="/testimonial">
|
|
||||||
<i class="fa-solid fa-star-half-stroke" aria-hidden="true"></i> Testimonials
|
|
||||||
</a>
|
|
||||||
|
@ -58,21 +58,11 @@
|
|||||||
>
|
>
|
||||||
Staff Applications
|
Staff Applications
|
||||||
</button>
|
</button>
|
||||||
<button
|
|
||||||
[disabled]="view === 'testimonials'"
|
|
||||||
type="button"
|
|
||||||
(click)="setView('testimonials')"
|
|
||||||
>
|
|
||||||
Testimonials
|
|
||||||
</button>
|
|
||||||
<h2>{{ view }}</h2>
|
<h2>{{ view }}</h2>
|
||||||
<div *ngFor="let datum of data">
|
<div *ngFor="let datum of data">
|
||||||
<h3>{{ datum.email }}</h3>
|
<h3>{{ datum.email }}</h3>
|
||||||
<div *ngFor="let obj of datum.info">
|
<div *ngFor="let obj of datum.info">
|
||||||
<p>
|
<p><strong>{{ obj.key }}</strong>: {{ obj.value }}</p>
|
||||||
<strong>{{ obj.key }}</strong
|
|
||||||
>: {{ obj.value }}
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
<button type="button" (click)="markReviewed(datum.id)">
|
<button type="button" (click)="markReviewed(datum.id)">
|
||||||
Mark as Reviewed
|
Mark as Reviewed
|
||||||
|
@ -41,8 +41,7 @@ export class ReviewComponent {
|
|||||||
| "events"
|
| "events"
|
||||||
| "meetings"
|
| "meetings"
|
||||||
| "mentorships"
|
| "mentorships"
|
||||||
| "staff"
|
| "staff" = "";
|
||||||
| "testimonials" = "";
|
|
||||||
|
|
||||||
public constructor(private readonly apiService: ApiService) {
|
public constructor(private readonly apiService: ApiService) {
|
||||||
const storedToken = localStorage.getItem("token");
|
const storedToken = localStorage.getItem("token");
|
||||||
@ -99,8 +98,7 @@ export class ReviewComponent {
|
|||||||
| "events"
|
| "events"
|
||||||
| "meetings"
|
| "meetings"
|
||||||
| "mentorships"
|
| "mentorships"
|
||||||
| "staff"
|
| "staff";
|
||||||
| "testimonials";
|
|
||||||
void this.apiService.
|
void this.apiService.
|
||||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- We know token is not null
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- We know token is not null
|
||||||
markReviewed(view, id, this.token.value!).then((data) => {
|
markReviewed(view, id, this.token.value!).then((data) => {
|
||||||
@ -122,8 +120,7 @@ export class ReviewComponent {
|
|||||||
| "events"
|
| "events"
|
||||||
| "meetings"
|
| "meetings"
|
||||||
| "mentorships"
|
| "mentorships"
|
||||||
| "staff"
|
| "staff",
|
||||||
| "testimonials",
|
|
||||||
): void {
|
): void {
|
||||||
this.view = view;
|
this.view = view;
|
||||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- We know token is not null
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- We know token is not null
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
/**
|
|
||||||
* @copyright nhcarrigan
|
|
||||||
* @license Naomi's Public License
|
|
||||||
* @author Naomi Carrigan
|
|
||||||
*/
|
|
||||||
|
|
||||||
export interface Testimonial {
|
|
||||||
consent: boolean;
|
|
||||||
content: string;
|
|
||||||
email: string;
|
|
||||||
firstName: string;
|
|
||||||
lastName: string;
|
|
||||||
}
|
|
@ -11,7 +11,6 @@ import type { Event } from "./forms/event.js";
|
|||||||
import type { Meeting } from "./forms/meeting.js";
|
import type { Meeting } from "./forms/meeting.js";
|
||||||
import type { Mentorship } from "./forms/mentorship.js";
|
import type { Mentorship } from "./forms/mentorship.js";
|
||||||
import type { Staff } from "./forms/staff.js";
|
import type { Staff } from "./forms/staff.js";
|
||||||
import type { Testimonial } from "./forms/testimonial.js";
|
|
||||||
import type { ReviewRequest } from "./requests/review.js";
|
import type { ReviewRequest } from "./requests/review.js";
|
||||||
import type { DataResponse } from "./responses/data.js";
|
import type { DataResponse } from "./responses/data.js";
|
||||||
import type { ErrorResponse } from "./responses/error.js";
|
import type { ErrorResponse } from "./responses/error.js";
|
||||||
@ -29,5 +28,4 @@ export type {
|
|||||||
DataResponse,
|
DataResponse,
|
||||||
ErrorResponse,
|
ErrorResponse,
|
||||||
SuccessResponse,
|
SuccessResponse,
|
||||||
Testimonial,
|
|
||||||
};
|
};
|
||||||
|
@ -103,12 +103,3 @@ model Mentorships {
|
|||||||
paymentUnderstanding Boolean
|
paymentUnderstanding Boolean
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
}
|
}
|
||||||
|
|
||||||
model Testimonials {
|
|
||||||
id String @id @default(auto()) @map("_id") @db.ObjectId
|
|
||||||
email String @unique
|
|
||||||
firstName String
|
|
||||||
lastName String
|
|
||||||
content String
|
|
||||||
createdAt DateTime @default(now())
|
|
||||||
}
|
|
||||||
|
@ -1,64 +0,0 @@
|
|||||||
/**
|
|
||||||
* @copyright nhcarrigan
|
|
||||||
* @license Naomi's Public License
|
|
||||||
* @author Naomi Carrigan
|
|
||||||
*/
|
|
||||||
import { validateBody } from "../../modules/validateBody.js";
|
|
||||||
import { logger } from "../../utils/logger.js";
|
|
||||||
import { sendMail } from "../../utils/mailer.js";
|
|
||||||
import type { PrismaClient } from "@prisma/client";
|
|
||||||
import type { Testimonial, ErrorResponse, SuccessResponse } from "@repo/types";
|
|
||||||
import type { FastifyReply, FastifyRequest } from "fastify";
|
|
||||||
|
|
||||||
/**
|
|
||||||
*Handles testimonial form submissions.
|
|
||||||
* @param database - The Prisma database client.
|
|
||||||
* @param request - The request object.
|
|
||||||
* @param response - The Fastify reply utility.
|
|
||||||
*/
|
|
||||||
export const submitTestimonialHandler = async(
|
|
||||||
database: PrismaClient,
|
|
||||||
request: FastifyRequest<{ Body: Testimonial }>,
|
|
||||||
response: FastifyReply<{ Reply: SuccessResponse | ErrorResponse }>,
|
|
||||||
): Promise<void> => {
|
|
||||||
try {
|
|
||||||
const isInvalid = validateBody(
|
|
||||||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- We're passing a narrower type and TS hates that?
|
|
||||||
request.body as unknown as Record<string, unknown>,
|
|
||||||
"testimonials",
|
|
||||||
);
|
|
||||||
if (isInvalid !== null) {
|
|
||||||
await response.status(400).send({ error: isInvalid });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const exists = await database.staff.findUnique({
|
|
||||||
where: {
|
|
||||||
email: request.body.email,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
if (exists !== null) {
|
|
||||||
await response.
|
|
||||||
status(429).
|
|
||||||
send({
|
|
||||||
error:
|
|
||||||
// eslint-disable-next-line stylistic/max-len -- This is a long string.
|
|
||||||
"You have already submitted a staff application. Please wait for it to be reviewed.",
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const data = { ...request.body };
|
|
||||||
// @ts-expect-error -- We're deleting a property here.
|
|
||||||
delete data.consent;
|
|
||||||
await database.testimonials.create({
|
|
||||||
data,
|
|
||||||
});
|
|
||||||
await sendMail("testimonials", data);
|
|
||||||
await response.send({ success: true });
|
|
||||||
} catch (error) {
|
|
||||||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- we bein' lazy.
|
|
||||||
await logger.error("/submit/testimonials", error as Error);
|
|
||||||
await response.status(500).send({ error: error instanceof Error
|
|
||||||
? error.message
|
|
||||||
: "Internal Server Error" });
|
|
||||||
}
|
|
||||||
};
|
|
@ -9,5 +9,4 @@ export type DatabasePath = | "appeals"
|
|||||||
| "events"
|
| "events"
|
||||||
| "meetings"
|
| "meetings"
|
||||||
| "mentorships"
|
| "mentorships"
|
||||||
| "staff"
|
| "staff";
|
||||||
| "testimonials";
|
|
||||||
|
@ -14,7 +14,6 @@ import type {
|
|||||||
Mentorships,
|
Mentorships,
|
||||||
PrismaClient,
|
PrismaClient,
|
||||||
Staff,
|
Staff,
|
||||||
Testimonials,
|
|
||||||
} from "@prisma/client";
|
} from "@prisma/client";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,17 +27,10 @@ const listUnreviewedSubmissions = async(
|
|||||||
route: DatabasePath,
|
route: DatabasePath,
|
||||||
): Promise<
|
): Promise<
|
||||||
Array<
|
Array<
|
||||||
| Appeals
|
Appeals | Commissions | Contacts | Events | Meetings | Mentorships | Staff
|
||||||
| Commissions
|
|
||||||
| Contacts
|
|
||||||
| Events
|
|
||||||
| Meetings
|
|
||||||
| Mentorships
|
|
||||||
| Staff
|
|
||||||
| Testimonials
|
|
||||||
>
|
>
|
||||||
> => {
|
> => {
|
||||||
const query = {};
|
const query = { };
|
||||||
switch (route) {
|
switch (route) {
|
||||||
case "appeals":
|
case "appeals":
|
||||||
return await database.appeals.findMany(query);
|
return await database.appeals.findMany(query);
|
||||||
@ -54,8 +46,6 @@ const listUnreviewedSubmissions = async(
|
|||||||
return await database.mentorships.findMany(query);
|
return await database.mentorships.findMany(query);
|
||||||
case "staff":
|
case "staff":
|
||||||
return await database.staff.findMany(query);
|
return await database.staff.findMany(query);
|
||||||
case "testimonials":
|
|
||||||
return await database.testimonials.findMany(query);
|
|
||||||
default:
|
default:
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
@ -89,8 +79,6 @@ const checkSubmissionExists = async(
|
|||||||
return Boolean(await database.mentorships.findUnique(query));
|
return Boolean(await database.mentorships.findUnique(query));
|
||||||
case "staff":
|
case "staff":
|
||||||
return Boolean(await database.staff.findUnique(query));
|
return Boolean(await database.staff.findUnique(query));
|
||||||
case "testimonials":
|
|
||||||
return Boolean(await database.testimonials.findUnique(query));
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -134,9 +122,6 @@ const markSubmissionReviewed = async(
|
|||||||
case "staff":
|
case "staff":
|
||||||
await database.staff.delete(update);
|
await database.staff.delete(update);
|
||||||
break;
|
break;
|
||||||
case "testimonials":
|
|
||||||
await database.testimonials.delete(update);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -70,12 +70,6 @@ const validators: Record<DatabasePath, Array<string>> = {
|
|||||||
"difficultSituation",
|
"difficultSituation",
|
||||||
"leadershipSituation",
|
"leadershipSituation",
|
||||||
],
|
],
|
||||||
testimonials: [
|
|
||||||
"firstName",
|
|
||||||
"lastName",
|
|
||||||
"email",
|
|
||||||
"content",
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,7 +22,6 @@ export const listRoutes: WrappedRoute = (database) => {
|
|||||||
"meetings",
|
"meetings",
|
||||||
"mentorships",
|
"mentorships",
|
||||||
"staff",
|
"staff",
|
||||||
"testimonials",
|
|
||||||
];
|
];
|
||||||
for (const route of routes) {
|
for (const route of routes) {
|
||||||
fastify.get(`/list/${route}`, async(_request, response) => {
|
fastify.get(`/list/${route}`, async(_request, response) => {
|
||||||
|
@ -27,7 +27,6 @@ export const reviewRoutes: WrappedRoute = (database) => {
|
|||||||
"meetings",
|
"meetings",
|
||||||
"mentorships",
|
"mentorships",
|
||||||
"staff",
|
"staff",
|
||||||
"testimonials",
|
|
||||||
];
|
];
|
||||||
for (const route of routes) {
|
for (const route of routes) {
|
||||||
fastify.put<{
|
fastify.put<{
|
||||||
|
@ -13,8 +13,6 @@ import { submitMeetingHandler } from "../handlers/submit/meetingHandler.js";
|
|||||||
import { submitMentorshipHandler }
|
import { submitMentorshipHandler }
|
||||||
from "../handlers/submit/mentorshipHandler.js";
|
from "../handlers/submit/mentorshipHandler.js";
|
||||||
import { submitStaffHandler } from "../handlers/submit/staffHandler.js";
|
import { submitStaffHandler } from "../handlers/submit/staffHandler.js";
|
||||||
import { submitTestimonialHandler }
|
|
||||||
from "../handlers/submit/testimonialHandler.js";
|
|
||||||
import type { WrappedRoute } from "../interfaces/wrappedRoute.js";
|
import type { WrappedRoute } from "../interfaces/wrappedRoute.js";
|
||||||
import type {
|
import type {
|
||||||
Appeal,
|
Appeal,
|
||||||
@ -26,7 +24,6 @@ import type {
|
|||||||
Staff,
|
Staff,
|
||||||
ErrorResponse,
|
ErrorResponse,
|
||||||
SuccessResponse,
|
SuccessResponse,
|
||||||
Testimonial,
|
|
||||||
} from "@repo/types";
|
} from "@repo/types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -34,7 +31,6 @@ import type {
|
|||||||
* @param database - The Prisma client.
|
* @param database - The Prisma client.
|
||||||
* @returns A Fastify plugin.
|
* @returns A Fastify plugin.
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line max-lines-per-function -- Prisma typings don't allow us to mount these dynamically...
|
|
||||||
export const submitRoutes: WrappedRoute = (database) => {
|
export const submitRoutes: WrappedRoute = (database) => {
|
||||||
return async(fastify) => {
|
return async(fastify) => {
|
||||||
fastify.post<{ Body: Appeal; Reply: SuccessResponse | ErrorResponse }>(
|
fastify.post<{ Body: Appeal; Reply: SuccessResponse | ErrorResponse }>(
|
||||||
@ -85,12 +81,5 @@ export const submitRoutes: WrappedRoute = (database) => {
|
|||||||
await submitStaffHandler(database, request, response);
|
await submitStaffHandler(database, request, response);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
fastify.post<{ Body: Testimonial; Reply: SuccessResponse | ErrorResponse }>(
|
|
||||||
"/submit/testimonials",
|
|
||||||
async(request, response) => {
|
|
||||||
await submitTestimonialHandler(database, request, response);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user