2 Commits

Author SHA1 Message Date
2f08f1ed18 feat: we have a functional prototype 2025-02-17 02:43:15 -08:00
107f54d269 feat: load in configs 2025-02-16 15:54:42 -08:00
63 changed files with 863 additions and 530 deletions

View File

@ -28,12 +28,6 @@ jobs:
- name: Install Dependencies - name: Install Dependencies
run: pnpm install run: pnpm install
- name: Build internal package
run: cd packages/types && pnpm build
- name: Install again
run: pnpm install
- name: Lint Source Files - name: Lint Source Files
run: pnpm run lint run: pnpm run lint
@ -41,4 +35,4 @@ jobs:
run: pnpm run build run: pnpm run build
- name: Run Tests - name: Run Tests
run: pnpm run test run: pnpm run test:ci

View File

@ -19,7 +19,7 @@
"polyfills": [ "polyfills": [
"zone.js" "zone.js"
], ],
"tsConfig": "tsconfig.json", "tsConfig": "tsconfig.app.json",
"assets": [ "assets": [
{ {
"glob": "**/*", "glob": "**/*",
@ -69,6 +69,26 @@
}, },
"extract-i18n": { "extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n" "builder": "@angular-devkit/build-angular:extract-i18n"
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"polyfills": [
"zone.js",
"zone.js/testing"
],
"tsConfig": "tsconfig.spec.json",
"assets": [
{
"glob": "**/*",
"input": "public"
}
],
"styles": [
"src/styles.css"
],
"scripts": []
}
} }
} }
} }

View File

@ -2,21 +2,4 @@ import NaomisConfig from "@nhcarrigan/eslint-config";
export default [ export default [
...NaomisConfig, ...NaomisConfig,
{
rules: {
"no-console": "off",
"new-cap": "off",
"@typescript-eslint/naming-convention": "off",
"jsdoc/require-jsdoc": "off",
"jsdoc/require-param": "off",
"jsdoc/require-returns": "off",
"@typescript-eslint/no-useless-constructor": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/consistent-type-assertions": "off",
"@typescript-eslint/no-extraneous-class": "off",
"stylistic/no-multi-spaces": "off",
"unicorn/filename-case": "off",
"@typescript-eslint/consistent-type-imports": "off"
},
},
] ]

View File

@ -6,7 +6,7 @@
"dev": "ng dev", "dev": "ng dev",
"lint": "eslint src --max-warnings 0", "lint": "eslint src --max-warnings 0",
"build": "ng build", "build": "ng build",
"test": "echo \"Error: no test specified\" && exit 0" "test": "ng test"
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
@ -27,15 +27,14 @@
"@angular/cli": "^19.1.7", "@angular/cli": "^19.1.7",
"@angular/compiler-cli": "^19.1.0", "@angular/compiler-cli": "^19.1.0",
"@nhcarrigan/eslint-config": "5.2.0", "@nhcarrigan/eslint-config": "5.2.0",
"@repo/types": "../packages/types",
"@types/jasmine": "~5.1.0", "@types/jasmine": "~5.1.0",
"eslint": "9.20.1",
"jasmine-core": "~5.5.0", "jasmine-core": "~5.5.0",
"karma": "~6.4.0", "karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0", "karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0", "karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0", "karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0", "karma-jasmine-html-reporter": "~2.1.0",
"typescript": "~5.7.2" "typescript": "~5.7.2",
"@repo/types": "../packages/types"
} }
} }

View File

@ -0,0 +1,15 @@
import { TestBed } from "@angular/core/testing";
import { ApiService } from "./api.service";
describe("ApiService", () => {
let service: ApiService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(ApiService);
});
it("should be created", () => {
expect(service).toBeTruthy();
});
});

View File

@ -1,38 +1,30 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { Injectable } from "@angular/core"; import { Injectable } from "@angular/core";
import type { import type { Appeal, Commission, Contact, ErrorResponse, Event, Meeting, Mentorship, SuccessResponse, Staff, DataResponse } from "@repo/types";
Appeal,
Commission,
Contact,
ErrorResponse,
Event,
Meeting,
Mentorship,
SuccessResponse,
Staff,
DataResponse,
} from "@repo/types";
/**
*
*/
@Injectable({ @Injectable({
providedIn: "root", providedIn: "root",
}) })
export class ApiService { export class ApiService {
public url = "https://forms-api.nhcarrigan.com"; public url = "http://localhost:1234";
public constructor() {} /**
*
*/
constructor() { }
/**
* @param token
*/
public async validateToken(token: string | null): Promise<boolean> { public async validateToken(token: string | null): Promise<boolean> {
if (token === null) { if (!token) {
return false; return false;
} }
const ipRequest = await fetch("https://api.ipify.org?format=json"); const ipRequest = await fetch("https://api.ipify.org?format=json");
const ipResult = await ipRequest.json() as { ip: string }; const ipRes = await ipRequest.json();
const { ip } = ipResult; const { ip } = ipRes;
const request = await fetch(`${this.url}/validate-token`, { const request = await fetch(`${this.url}/validate-token`, {
body: JSON.stringify({ ip, token }), body: JSON.stringify({ ip, token }),
headers: { headers: {
@ -40,13 +32,14 @@ export class ApiService {
}, },
method: "POST", method: "POST",
}); });
const response = await request.json() as { valid: boolean }; const response = await request.json();
return response.valid; return response.valid;
} }
public async submitAppeal( /**
appeal: Partial<Appeal>, * @param appeal
): Promise<SuccessResponse | ErrorResponse> { */
public async submitAppeal(appeal: Partial<Appeal>): Promise<SuccessResponse | ErrorResponse> {
const request = await fetch(`${this.url}/submit/appeals`, { const request = await fetch(`${this.url}/submit/appeals`, {
body: JSON.stringify(appeal), body: JSON.stringify(appeal),
headers: { headers: {
@ -54,13 +47,14 @@ export class ApiService {
}, },
method: "POST", method: "POST",
}); });
const response = await request.json() as SuccessResponse | ErrorResponse; const response = await request.json();
return response; return response;
} }
public async submitCommission( /**
commission: Partial<Commission>, * @param commission
): Promise<SuccessResponse | ErrorResponse> { */
public async submitCommission(commission: Partial<Commission>): Promise<SuccessResponse | ErrorResponse> {
const request = await fetch(`${this.url}/submit/commissions`, { const request = await fetch(`${this.url}/submit/commissions`, {
body: JSON.stringify(commission), body: JSON.stringify(commission),
headers: { headers: {
@ -68,13 +62,14 @@ export class ApiService {
}, },
method: "POST", method: "POST",
}); });
const response = await request.json() as SuccessResponse | ErrorResponse; const response = await request.json();
return response; return response;
} }
public async submitContact( /**
contact: Partial<Contact>, * @param contact
): Promise<SuccessResponse | ErrorResponse> { */
public async submitContact(contact: Partial<Contact>): Promise<SuccessResponse | ErrorResponse> {
const request = await fetch(`${this.url}/submit/contacts`, { const request = await fetch(`${this.url}/submit/contacts`, {
body: JSON.stringify(contact), body: JSON.stringify(contact),
headers: { headers: {
@ -82,13 +77,14 @@ export class ApiService {
}, },
method: "POST", method: "POST",
}); });
const response = await request.json() as SuccessResponse | ErrorResponse; const response = await request.json();
return response; return response;
} }
public async submitEvent( /**
event: Partial<Event>, * @param event
): Promise<SuccessResponse | ErrorResponse> { */
public async submitEvent(event: Partial<Event>): Promise<SuccessResponse | ErrorResponse> {
const request = await fetch(`${this.url}/submit/events`, { const request = await fetch(`${this.url}/submit/events`, {
body: JSON.stringify(event), body: JSON.stringify(event),
headers: { headers: {
@ -96,13 +92,14 @@ export class ApiService {
}, },
method: "POST", method: "POST",
}); });
const response = await request.json() as SuccessResponse | ErrorResponse; const response = await request.json();
return response; return response;
} }
public async submitMeeting( /**
meeting: Partial<Meeting>, * @param meeting
): Promise<SuccessResponse | ErrorResponse> { */
public async submitMeeting(meeting: Partial<Meeting>): Promise<SuccessResponse | ErrorResponse> {
const request = await fetch(`${this.url}/submit/meetings`, { const request = await fetch(`${this.url}/submit/meetings`, {
body: JSON.stringify(meeting), body: JSON.stringify(meeting),
headers: { headers: {
@ -110,13 +107,14 @@ export class ApiService {
}, },
method: "POST", method: "POST",
}); });
const response = await request.json() as SuccessResponse | ErrorResponse; const response = await request.json();
return response; return response;
} }
public async submitMentorship( /**
mentorship: Partial<Mentorship>, * @param mentorship
): Promise<SuccessResponse | ErrorResponse> { */
public async submitMentorship(mentorship: Partial<Mentorship>): Promise<SuccessResponse | ErrorResponse> {
const request = await fetch(`${this.url}/submit/mentorships`, { const request = await fetch(`${this.url}/submit/mentorships`, {
body: JSON.stringify(mentorship), body: JSON.stringify(mentorship),
headers: { headers: {
@ -124,13 +122,14 @@ export class ApiService {
}, },
method: "POST", method: "POST",
}); });
const response = await request.json() as SuccessResponse | ErrorResponse; const response = await request.json();
return response; return response;
} }
public async submitStaff( /**
staff: Partial<Staff>, * @param staff
): Promise<SuccessResponse | ErrorResponse> { */
public async submitStaff(staff: Partial<Staff>): Promise<SuccessResponse | ErrorResponse> {
const request = await fetch(`${this.url}/submit/staff`, { const request = await fetch(`${this.url}/submit/staff`, {
body: JSON.stringify(staff), body: JSON.stringify(staff),
headers: { headers: {
@ -138,21 +137,15 @@ export class ApiService {
}, },
method: "POST", method: "POST",
}); });
const response = await request.json() as SuccessResponse | ErrorResponse; const response = await request.json();
return response; return response;
} }
public async getData( /**
type: * @param type
| "appeals" * @param token
| "commissions" */
| "contacts" public async getData(type: "appeals" | "commissions" | "contacts" | "events" | "meetings" | "mentorships" | "staff", token: string): Promise<DataResponse | ErrorResponse> {
| "events"
| "meetings"
| "mentorships"
| "staff",
token: string,
): Promise<DataResponse | ErrorResponse> {
const request = await fetch(`${this.url}/list/${type}`, { const request = await fetch(`${this.url}/list/${type}`, {
headers: { headers: {
"Authorization": token, "Authorization": token,
@ -160,22 +153,16 @@ export class ApiService {
}, },
method: "GET", method: "GET",
}); });
const response = await request.json() as DataResponse | ErrorResponse; const response = await request.json();
return response; return response;
} }
public async markReviewed( /**
type: * @param type
| "appeals" * @param id
| "commissions" * @param token
| "contacts" */
| "events" public async markReviewed(type: "appeals" | "commissions" | "contacts" | "events" | "meetings" | "mentorships" | "staff", id: string, token: string): Promise<SuccessResponse | ErrorResponse> {
| "meetings"
| "mentorships"
| "staff",
id: string,
token: string,
): Promise<SuccessResponse | ErrorResponse> {
const request = await fetch(`${this.url}/review/${type}`, { const request = await fetch(`${this.url}/review/${type}`, {
body: JSON.stringify({ submissionId: id }), body: JSON.stringify({ submissionId: id }),
headers: { headers: {
@ -184,7 +171,7 @@ export class ApiService {
}, },
method: "PUT", method: "PUT",
}); });
const response = await request.json() as SuccessResponse | ErrorResponse; const response = await request.json();
return response; return response;
} }
} }

View File

@ -0,0 +1,29 @@
import { TestBed } from "@angular/core/testing";
import { AppComponent } from "./app.component";
describe("AppComponent", () => {
beforeEach(async() => {
await TestBed.configureTestingModule({
imports: [ AppComponent ],
}).compileComponents();
});
it("should create the app", () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});
it(`should have the 'client' title`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual("client");
});
it("should render title", () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector("h1")?.textContent).toContain("Hello, client");
});
});

View File

@ -1,18 +1,15 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { Component } from "@angular/core"; import { Component } from "@angular/core";
import { RouterOutlet } from "@angular/router"; import { RouterOutlet } from "@angular/router";
/**
*
*/
@Component({ @Component({
imports: [ RouterOutlet ], imports: [ RouterOutlet ],
selector: "app-root", selector: 'app-root',
styleUrl: "./app.component.css", styleUrl: './app.component.css',
templateUrl: "./app.component.html", templateUrl: "./app.component.html",
}) })
export class AppComponent { export class AppComponent {
public title = "NHCarrigan Forms"; title = "NHCarrigan Forms";
} }

View File

@ -1,17 +1,7 @@
/** import { type ApplicationConfig, provideZoneChangeDetection } from "@angular/core";
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { type ApplicationConfig, provideZoneChangeDetection }
from "@angular/core";
import { provideRouter } from "@angular/router"; import { provideRouter } from "@angular/router";
import { routes } from "./app.routes"; import { routes } from "./app.routes";
export const appConfig: ApplicationConfig = { export const appConfig: ApplicationConfig = {
providers: [ providers: [ provideZoneChangeDetection({ eventCoalescing: true }), provideRouter(routes) ],
provideZoneChangeDetection({ eventCoalescing: true }),
provideRouter(routes),
],
}; };

View File

@ -1,17 +1,9 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { AppealComponent } from "./forms/appeal/appeal.component.js"; import { AppealComponent } from "./forms/appeal/appeal.component.js";
import { CommissionComponent } import { CommissionComponent } from "./forms/commission/commission.component.js";
from "./forms/commission/commission.component.js";
import { ContactComponent } from "./forms/contact/contact.component.js"; import { ContactComponent } from "./forms/contact/contact.component.js";
import { EventComponent } from "./forms/event/event.component.js"; import { EventComponent } from "./forms/event/event.component.js";
import { MeetingComponent } from "./forms/meeting/meeting.component.js"; 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 { 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";

View File

@ -0,0 +1,22 @@
import { type ComponentFixture, TestBed } from "@angular/core/testing";
import { ConsentComponent } from "./consent.component";
describe("ConsentComponent", () => {
let component: ConsentComponent;
let fixture: ComponentFixture<ConsentComponent>;
beforeEach(async() => {
await TestBed.configureTestingModule({
imports: [ ConsentComponent ],
}).
compileComponents();
fixture = TestBed.createComponent(ConsentComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it("should create", () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,15 +1,13 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { Component, input } from "@angular/core"; import { Component, input } from "@angular/core";
import { type FormControl, ReactiveFormsModule } from "@angular/forms"; import { type FormControl, ReactiveFormsModule } from "@angular/forms";
/**
*
*/
@Component({ @Component({
imports: [ ReactiveFormsModule ], imports: [ ReactiveFormsModule ],
selector: "app-consent", selector: 'app-consent',
styleUrl: "./consent.component.css", styleUrl: './consent.component.css',
templateUrl: "./consent.component.html", templateUrl: "./consent.component.html",
}) })
export class ConsentComponent { export class ConsentComponent {

View File

@ -0,0 +1,22 @@
import { type ComponentFixture, TestBed } from "@angular/core/testing";
import { ErrorComponent } from "./error.component";
describe("ErrorComponent", () => {
let component: ErrorComponent;
let fixture: ComponentFixture<ErrorComponent>;
beforeEach(async() => {
await TestBed.configureTestingModule({
imports: [ ErrorComponent ],
}).
compileComponents();
fixture = TestBed.createComponent(ErrorComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it("should create", () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,14 +1,12 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { Component, input } from "@angular/core"; import { Component, input } from "@angular/core";
/**
*
*/
@Component({ @Component({
imports: [], imports: [],
selector: "app-error", selector: 'app-error',
styleUrl: "./error.component.css", styleUrl: './error.component.css',
templateUrl: "./error.component.html", templateUrl: "./error.component.html",
}) })
export class ErrorComponent { export class ErrorComponent {

View File

@ -0,0 +1,22 @@
import { type ComponentFixture, TestBed } from "@angular/core/testing";
import { AppealComponent } from "./appeal.component";
describe("AppealComponent", () => {
let component: AppealComponent;
let fixture: ComponentFixture<AppealComponent>;
beforeEach(async() => {
await TestBed.configureTestingModule({
imports: [ AppealComponent ],
}).
compileComponents();
fixture = TestBed.createComponent(AppealComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it("should create", () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,27 +1,22 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { CommonModule } from "@angular/common"; import { CommonModule } from "@angular/common";
import { Component } from "@angular/core"; import { Component } from "@angular/core";
import { ReactiveFormsModule, FormControl } from "@angular/forms"; import { ReactiveFormsModule, FormControl } from "@angular/forms";
import { RouterModule } from "@angular/router"; import { RouterModule } from "@angular/router";
import { ApiService } from "../../api.service"; import { ConsentComponent } from "../../consent/consent.component.js";
import { ConsentComponent } from "../../consent/consent.component"; import { ErrorComponent } from "../../error/error.component.js";
import { ErrorComponent } from "../../error/error.component"; import { CheckboxComponent } from "../../inputs/checkbox/checkbox.component.js";
import { CheckboxComponent } from "../../inputs/checkbox/checkbox.component"; import { MultiLineComponent } from "../../inputs/multi-line/multi-line.component.js";
import { MultiLineComponent } import { SelectMenuComponent } from "../../inputs/select-menu/select-menu.component.js";
from "../../inputs/multi-line/multi-line.component"; import { SingleLineComponent } from "../../inputs/single-line/single-line.component.js";
import { SelectMenuComponent } import { SuccessComponent } from "../../success/success.component.js";
from "../../inputs/select-menu/select-menu.component"; import { UserinfoComponent } from "../../userinfo/userinfo.component.js";
import { SingleLineComponent } import type { ApiService } from "../../api.service.js";
from "../../inputs/single-line/single-line.component"; import type { Platform } from "@repo/types/prod/unions/platform.js";
import { SuccessComponent } from "../../success/success.component"; import type { Sanction } from "@repo/types/prod/unions/sanction.js";
import { UserinfoComponent } from "../../userinfo/userinfo.component";
import type { Platform } from "@repo/types/prod/unions/platform";
import type { Sanction } from "@repo/types/prod/unions/sanction";
/**
*
*/
@Component({ @Component({
imports: [ imports: [
RouterModule, RouterModule,
@ -36,8 +31,8 @@ import type { Sanction } from "@repo/types/prod/unions/sanction";
MultiLineComponent, MultiLineComponent,
SuccessComponent, SuccessComponent,
], ],
selector: "appeal-form", selector: 'appeal-form',
styleUrl: "./appeal.component.css", styleUrl: './appeal.component.css',
templateUrl: "./appeal.component.html", templateUrl: "./appeal.component.html",
}) })
export class AppealComponent { export class AppealComponent {
@ -63,40 +58,45 @@ export class AppealComponent {
public consent = new FormControl(false); public consent = new FormControl(false);
public constructor(private readonly apiService: ApiService) {} /**
* @param apiService
*/
constructor(private readonly apiService: ApiService) {}
// eslint-disable-next-line complexity -- stfu /**
public submit(event: MouseEvent): void { * @param e
*/
public submit(e: MouseEvent): void {
this.error = ""; this.error = "";
const { form } = event.target as HTMLButtonElement; const { form } = e.target as HTMLButtonElement;
const valid = form?.reportValidity(); const valid = form?.reportValidity();
if (valid !== true) { if (!valid) {
return; return;
} }
this.loading = true; this.loading = true;
this.apiService. this.apiService.
submitAppeal({ submitAppeal({
appealReason: this.appealReason.value ?? undefined,
behaviourImprove: this.behaviourImprove.value ?? undefined,
behaviourViolation: this.behaviourViolation.value ?? undefined,
caseNumber: Number.parseInt(this.caseNumber.value ?? "0", 10), caseNumber: Number.parseInt(this.caseNumber.value ?? "0", 10),
consent: this.consent.value ?? false,
email: this.email.value ?? undefined, email: this.email.value ?? undefined,
appealReason: this.appealReason.value ?? undefined,
firstName: this.firstName.value ?? undefined, firstName: this.firstName.value ?? undefined,
lastName: this.lastName.value ?? undefined, behaviourImprove: this.behaviourImprove.value ?? undefined,
platformUsername: this.platformUsername.value ?? undefined, lastName: this.lastName.value ?? undefined,
sanctionFair: this.sanctionFair.value ?? undefined, behaviourViolation: this.behaviourViolation.value ?? undefined,
platformUsername: this.platformUsername.value ?? undefined,
consent: this.consent.value ?? false,
sanctionFair: this.sanctionFair.value ?? undefined,
sanctionPlatform: this.sanctionPlatform.value ?? undefined, sanctionPlatform: this.sanctionPlatform.value ?? undefined,
sanctionReason: this.sanctionReason.value ?? undefined,
sanctionType: sanctionType:
(this.sanctionType.value?.split(/\s+/)[0] as Sanction | undefined) (this.sanctionType.value?.split(/\s+/)[0] as Sanction | undefined)
?? undefined, ?? undefined,
sanctionReason: this.sanctionReason.value ?? undefined,
understandBinding: this.understandBinding.value ?? undefined, understandBinding: this.understandBinding.value ?? undefined,
}). }).
then((response) => { then((res) => {
if ("error" in response) { if ("error" in res) {
this.error = response.error; this.error = res.error;
this.loading = false; this.loading = false;
} else { } else {
this.error = ""; this.error = "";

View File

@ -0,0 +1,22 @@
import { type ComponentFixture, TestBed } from "@angular/core/testing";
import { CommissionComponent } from "./commission.component";
describe("CommissionComponent", () => {
let component: CommissionComponent;
let fixture: ComponentFixture<CommissionComponent>;
beforeEach(async() => {
await TestBed.configureTestingModule({
imports: [ CommissionComponent ],
}).
compileComponents();
fixture = TestBed.createComponent(CommissionComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it("should create", () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,20 +1,17 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { CommonModule } from "@angular/common"; import { CommonModule } from "@angular/common";
import { Component } from "@angular/core"; import { Component } from "@angular/core";
import { FormControl, ReactiveFormsModule } from "@angular/forms"; import { FormControl, ReactiveFormsModule } from "@angular/forms";
import { RouterModule } from "@angular/router"; import { RouterModule } from "@angular/router";
import { ApiService } from "../../api.service"; import { ConsentComponent } from "../../consent/consent.component.js";
import { ConsentComponent } from "../../consent/consent.component"; import { ErrorComponent } from "../../error/error.component.js";
import { ErrorComponent } from "../../error/error.component"; import { MultiLineComponent } from "../../inputs/multi-line/multi-line.component.js";
import { MultiLineComponent } import { SuccessComponent } from "../../success/success.component.js";
from "../../inputs/multi-line/multi-line.component"; import { UserinfoComponent } from "../../userinfo/userinfo.component.js";
import { SuccessComponent } from "../../success/success.component"; import type { ApiService } from "../../api.service.js";
import { UserinfoComponent } from "../../userinfo/userinfo.component";
/**
*
*/
@Component({ @Component({
imports: [ imports: [
RouterModule, RouterModule,
@ -26,8 +23,8 @@ import { UserinfoComponent } from "../../userinfo/userinfo.component";
MultiLineComponent, MultiLineComponent,
SuccessComponent, SuccessComponent,
], ],
selector: "commission-form", selector: 'commission-form',
styleUrl: "./commission.component.css", styleUrl: './commission.component.css',
templateUrl: "./commission.component.html", templateUrl: "./commission.component.html",
}) })
export class CommissionComponent { export class CommissionComponent {
@ -44,13 +41,19 @@ export class CommissionComponent {
public consent = new FormControl(false); public consent = new FormControl(false);
public constructor(private readonly apiService: ApiService) {} /**
* @param apiService
*/
constructor(private readonly apiService: ApiService) {}
public submit(event: MouseEvent): void { /**
* @param e
*/
public submit(e: MouseEvent): void {
this.error = ""; this.error = "";
const { form } = event.target as HTMLButtonElement; const { form } = e.target as HTMLButtonElement;
const valid = form?.reportValidity(); const valid = form?.reportValidity();
if (valid !== true) { if (!valid) {
return; return;
} }
this.loading = true; this.loading = true;
@ -64,9 +67,9 @@ export class CommissionComponent {
lastName: this.lastName.value ?? undefined, lastName: this.lastName.value ?? undefined,
request: this.request.value ?? undefined, request: this.request.value ?? undefined,
}). }).
then((response) => { then((res) => {
if ("error" in response) { if ("error" in res) {
this.error = response.error; this.error = res.error;
this.loading = false; this.loading = false;
} else { } else {
this.error = ""; this.error = "";

View File

@ -0,0 +1,22 @@
import { type ComponentFixture, TestBed } from "@angular/core/testing";
import { ContactComponent } from "./contact.component";
describe("ContactComponent", () => {
let component: ContactComponent;
let fixture: ComponentFixture<ContactComponent>;
beforeEach(async() => {
await TestBed.configureTestingModule({
imports: [ ContactComponent ],
}).
compileComponents();
fixture = TestBed.createComponent(ContactComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it("should create", () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,20 +1,17 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { CommonModule } from "@angular/common"; import { CommonModule } from "@angular/common";
import { Component } from "@angular/core"; import { Component } from "@angular/core";
import { FormControl, ReactiveFormsModule } from "@angular/forms"; import { FormControl, ReactiveFormsModule } from "@angular/forms";
import { RouterModule } from "@angular/router"; import { RouterModule } from "@angular/router";
import { ApiService } from "../../api.service"; import { ConsentComponent } from "../../consent/consent.component.js";
import { ConsentComponent } from "../../consent/consent.component"; import { ErrorComponent } from "../../error/error.component.js";
import { ErrorComponent } from "../../error/error.component"; import { MultiLineComponent } from "../../inputs/multi-line/multi-line.component.js";
import { MultiLineComponent } import { SuccessComponent } from "../../success/success.component.js";
from "../../inputs/multi-line/multi-line.component"; import { UserinfoComponent } from "../../userinfo/userinfo.component.js";
import { SuccessComponent } from "../../success/success.component"; import type { ApiService } from "../../api.service.js";
import { UserinfoComponent } from "../../userinfo/userinfo.component";
/**
*
*/
@Component({ @Component({
imports: [ imports: [
RouterModule, RouterModule,
@ -26,8 +23,8 @@ import { UserinfoComponent } from "../../userinfo/userinfo.component";
MultiLineComponent, MultiLineComponent,
SuccessComponent, SuccessComponent,
], ],
selector: "contact-form", selector: 'contact-form',
styleUrl: "./contact.component.css", styleUrl: './contact.component.css',
templateUrl: "./contact.component.html", templateUrl: "./contact.component.html",
}) })
export class ContactComponent { export class ContactComponent {
@ -44,13 +41,19 @@ export class ContactComponent {
public consent = new FormControl(false); public consent = new FormControl(false);
public constructor(private readonly apiService: ApiService) {} /**
* @param apiService
*/
constructor(private readonly apiService: ApiService) {}
public submit(event: MouseEvent): void { /**
* @param e
*/
public submit(e: MouseEvent): void {
this.error = ""; this.error = "";
const { form } = event.target as HTMLButtonElement; const { form } = e.target as HTMLButtonElement;
const valid = form?.reportValidity(); const valid = form?.reportValidity();
if (valid !== true) { if (!valid) {
return; return;
} }
this.loading = true; this.loading = true;
@ -64,9 +67,9 @@ export class ContactComponent {
lastName: this.lastName.value ?? undefined, lastName: this.lastName.value ?? undefined,
request: this.request.value ?? undefined, request: this.request.value ?? undefined,
}). }).
then((response) => { then((res) => {
if ("error" in response) { if ("error" in res) {
this.error = response.error; this.error = res.error;
this.loading = false; this.loading = false;
} else { } else {
this.error = ""; this.error = "";

View File

@ -0,0 +1,22 @@
import { type ComponentFixture, TestBed } from "@angular/core/testing";
import { EventComponent } from "./event.component";
describe("EventComponent", () => {
let component: EventComponent;
let fixture: ComponentFixture<EventComponent>;
beforeEach(async() => {
await TestBed.configureTestingModule({
imports: [ EventComponent ],
}).
compileComponents();
fixture = TestBed.createComponent(EventComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it("should create", () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,23 +1,19 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { CommonModule } from "@angular/common"; import { CommonModule } from "@angular/common";
import { Component } from "@angular/core"; import { Component } from "@angular/core";
import { FormControl, ReactiveFormsModule } from "@angular/forms"; import { FormControl, ReactiveFormsModule } from "@angular/forms";
import { RouterModule } from "@angular/router"; import { RouterModule } from "@angular/router";
import { ApiService } from "../../api.service"; import { ConsentComponent } from "../../consent/consent.component.js";
import { ConsentComponent } from "../../consent/consent.component"; import { ErrorComponent } from "../../error/error.component.js";
import { ErrorComponent } from "../../error/error.component"; import { CheckboxComponent } from "../../inputs/checkbox/checkbox.component.js";
import { CheckboxComponent } from "../../inputs/checkbox/checkbox.component"; import { MultiLineComponent } from "../../inputs/multi-line/multi-line.component.js";
import { MultiLineComponent } import { SingleLineComponent } from "../../inputs/single-line/single-line.component.js";
from "../../inputs/multi-line/multi-line.component"; import { SuccessComponent } from "../../success/success.component.js";
import { SingleLineComponent } import { UserinfoComponent } from "../../userinfo/userinfo.component.js";
from "../../inputs/single-line/single-line.component"; import type { ApiService } from "../../api.service.js";
import { SuccessComponent } from "../../success/success.component";
import { UserinfoComponent } from "../../userinfo/userinfo.component";
/**
*
*/
@Component({ @Component({
imports: [ imports: [
RouterModule, RouterModule,
@ -31,8 +27,8 @@ import { UserinfoComponent } from "../../userinfo/userinfo.component";
MultiLineComponent, MultiLineComponent,
SuccessComponent, SuccessComponent,
], ],
selector: "event-form", selector: 'event-form',
styleUrl: "./event.component.css", styleUrl: './event.component.css',
templateUrl: "./event.component.html", templateUrl: "./event.component.html",
}) })
export class EventComponent { export class EventComponent {
@ -56,14 +52,19 @@ export class EventComponent {
public consent = new FormControl(false); public consent = new FormControl(false);
public constructor(private readonly apiService: ApiService) {} /**
* @param apiService
*/
constructor(private readonly apiService: ApiService) {}
// eslint-disable-next-line complexity -- stfu /**
public submit(event: MouseEvent): void { * @param e
*/
public submit(e: MouseEvent): void {
this.error = ""; this.error = "";
const { form } = event.target as HTMLButtonElement; const { form } = e.target as HTMLButtonElement;
const valid = form?.reportValidity(); const valid = form?.reportValidity();
if (valid !== true) { if (!valid) {
return; return;
} }
this.loading = true; this.loading = true;
@ -71,8 +72,8 @@ export class EventComponent {
this.apiService. this.apiService.
submitEvent({ submitEvent({
companyName: this.company.value ?? undefined, companyName: this.company.value ?? undefined,
consent: this.consent.value ?? false,
email: this.email.value ?? undefined, email: this.email.value ?? undefined,
consent: this.consent.value ?? false,
eventBudget: this.eventBudget.value ?? undefined, eventBudget: this.eventBudget.value ?? undefined,
eventDate: this.eventDate.value ?? undefined, eventDate: this.eventDate.value ?? undefined,
eventDescription: this.eventDescription.value ?? undefined, eventDescription: this.eventDescription.value ?? undefined,
@ -84,9 +85,9 @@ export class EventComponent {
lodgingCovered: this.lodgingCovered.value ?? false, lodgingCovered: this.lodgingCovered.value ?? false,
travelCovered: this.travelCovered.value ?? false, travelCovered: this.travelCovered.value ?? false,
}). }).
then((response) => { then((res) => {
if ("error" in response) { if ("error" in res) {
this.error = response.error; this.error = res.error;
this.loading = false; this.loading = false;
} else { } else {
this.error = ""; this.error = "";

View File

@ -0,0 +1,22 @@
import { type ComponentFixture, TestBed } from "@angular/core/testing";
import { MeetingComponent } from "./meeting.component";
describe("MeetingComponent", () => {
let component: MeetingComponent;
let fixture: ComponentFixture<MeetingComponent>;
beforeEach(async() => {
await TestBed.configureTestingModule({
imports: [ MeetingComponent ],
}).
compileComponents();
fixture = TestBed.createComponent(MeetingComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it("should create", () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,24 +1,20 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { CommonModule } from "@angular/common"; import { CommonModule } from "@angular/common";
import { Component } from "@angular/core"; import { Component } from "@angular/core";
import { FormControl, ReactiveFormsModule } from "@angular/forms"; import { FormControl, ReactiveFormsModule } from "@angular/forms";
import { RouterModule } from "@angular/router"; import { RouterModule } from "@angular/router";
import { ApiService } from "../../api.service"; import { ConsentComponent } from "../../consent/consent.component.js";
import { ConsentComponent } from "../../consent/consent.component"; import { ErrorComponent } from "../../error/error.component.js";
import { ErrorComponent } from "../../error/error.component"; import { CheckboxComponent } from "../../inputs/checkbox/checkbox.component.js";
import { CheckboxComponent } from "../../inputs/checkbox/checkbox.component"; import { MultiLineComponent } from "../../inputs/multi-line/multi-line.component.js";
import { MultiLineComponent } import { SelectMenuComponent } from "../../inputs/select-menu/select-menu.component.js";
from "../../inputs/multi-line/multi-line.component"; import { SuccessComponent } from "../../success/success.component.js";
import { SelectMenuComponent } import { UserinfoComponent } from "../../userinfo/userinfo.component.js";
from "../../inputs/select-menu/select-menu.component"; import type { ApiService } from "../../api.service.js";
import { SuccessComponent } from "../../success/success.component"; import type { SessionLength } from "@repo/types/prod/unions/session.js";
import { UserinfoComponent } from "../../userinfo/userinfo.component";
import type { SessionLength } from "@repo/types/prod/unions/session";
/**
*
*/
@Component({ @Component({
imports: [ imports: [
RouterModule, RouterModule,
@ -32,8 +28,8 @@ import type { SessionLength } from "@repo/types/prod/unions/session";
MultiLineComponent, MultiLineComponent,
SuccessComponent, SuccessComponent,
], ],
selector: "meeting-form", selector: 'meeting-form',
styleUrl: "./meeting.component.css", styleUrl: './meeting.component.css',
templateUrl: "./meeting.component.html", templateUrl: "./meeting.component.html",
}) })
export class MeetingComponent { export class MeetingComponent {
@ -52,14 +48,19 @@ export class MeetingComponent {
public consent = new FormControl(false); public consent = new FormControl(false);
public constructor(private readonly apiService: ApiService) {} /**
* @param apiService
*/
constructor(private readonly apiService: ApiService) {}
// eslint-disable-next-line complexity -- stfu /**
public submit(event: MouseEvent): void { * @param e
*/
public submit(e: MouseEvent): void {
this.error = ""; this.error = "";
const { form } = event.target as HTMLButtonElement; const { form } = e.target as HTMLButtonElement;
const valid = form?.reportValidity(); const valid = form?.reportValidity();
if (valid !== true) { if (!valid) {
return; return;
} }
this.loading = true; this.loading = true;
@ -73,13 +74,11 @@ export class MeetingComponent {
lastName: this.lastName.value ?? undefined, lastName: this.lastName.value ?? undefined,
paymentUnderstanding: this.paymentUnderstanding.value ?? undefined, paymentUnderstanding: this.paymentUnderstanding.value ?? undefined,
sessionGoal: this.sessionGoal.value ?? undefined, sessionGoal: this.sessionGoal.value ?? undefined,
sessionLength: Number.parseInt( sessionLength: Number.parseInt(this.sessionLength.value ?? "15", 10) as SessionLength,
this.sessionLength.value ?? "15", 10,
) as SessionLength,
}). }).
then((response) => { then((res) => {
if ("error" in response) { if ("error" in res) {
this.error = response.error; this.error = res.error;
this.loading = false; this.loading = false;
} else { } else {
this.error = ""; this.error = "";

View File

@ -0,0 +1,22 @@
import { type ComponentFixture, TestBed } from "@angular/core/testing";
import { MentorshipComponent } from "./mentorship.component";
describe("MentorshipComponent", () => {
let component: MentorshipComponent;
let fixture: ComponentFixture<MentorshipComponent>;
beforeEach(async() => {
await TestBed.configureTestingModule({
imports: [ MentorshipComponent ],
}).
compileComponents();
fixture = TestBed.createComponent(MentorshipComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it("should create", () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,21 +1,18 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { CommonModule } from "@angular/common"; import { CommonModule } from "@angular/common";
import { Component } from "@angular/core"; import { Component } from "@angular/core";
import { FormControl, ReactiveFormsModule } from "@angular/forms"; import { FormControl, ReactiveFormsModule } from "@angular/forms";
import { RouterModule } from "@angular/router"; import { RouterModule } from "@angular/router";
import { ApiService } from "../../api.service"; import { ConsentComponent } from "../../consent/consent.component.js";
import { ConsentComponent } from "../../consent/consent.component"; import { ErrorComponent } from "../../error/error.component.js";
import { ErrorComponent } from "../../error/error.component"; import { CheckboxComponent } from "../../inputs/checkbox/checkbox.component.js";
import { CheckboxComponent } from "../../inputs/checkbox/checkbox.component"; import { MultiLineComponent } from "../../inputs/multi-line/multi-line.component.js";
import { MultiLineComponent } import { SuccessComponent } from "../../success/success.component.js";
from "../../inputs/multi-line/multi-line.component"; import { UserinfoComponent } from "../../userinfo/userinfo.component.js";
import { SuccessComponent } from "../../success/success.component"; import type { ApiService } from "../../api.service.js";
import { UserinfoComponent } from "../../userinfo/userinfo.component";
/**
*
*/
@Component({ @Component({
imports: [ imports: [
RouterModule, RouterModule,
@ -28,8 +25,8 @@ import { UserinfoComponent } from "../../userinfo/userinfo.component";
MultiLineComponent, MultiLineComponent,
SuccessComponent, SuccessComponent,
], ],
selector: "mentorship-form", selector: 'mentorship-form',
styleUrl: "./mentorship.component.css", styleUrl: './mentorship.component.css',
templateUrl: "./mentorship.component.html", templateUrl: "./mentorship.component.html",
}) })
export class MentorshipComponent { export class MentorshipComponent {
@ -48,14 +45,19 @@ export class MentorshipComponent {
public consent = new FormControl(false); public consent = new FormControl(false);
public constructor(private readonly apiService: ApiService) {} /**
* @param apiService
*/
constructor(private readonly apiService: ApiService) {}
// eslint-disable-next-line complexity -- stfu /**
public submit(event: MouseEvent): void { * @param e
*/
public submit(e: MouseEvent): void {
this.error = ""; this.error = "";
const { form } = event.target as HTMLButtonElement; const { form } = e.target as HTMLButtonElement;
const valid = form?.reportValidity(); const valid = form?.reportValidity();
if (valid !== true) { if (!valid) {
return; return;
} }
this.loading = true; this.loading = true;
@ -71,9 +73,9 @@ export class MentorshipComponent {
mentorshipGoal: this.mentorshipGoal.value ?? undefined, mentorshipGoal: this.mentorshipGoal.value ?? undefined,
paymentUnderstanding: this.paymentUnderstanding.value ?? false, paymentUnderstanding: this.paymentUnderstanding.value ?? false,
}). }).
then((response) => { then((res) => {
if ("error" in response) { if ("error" in res) {
this.error = response.error; this.error = res.error;
this.loading = false; this.loading = false;
} else { } else {
this.error = ""; this.error = "";

View File

@ -0,0 +1,22 @@
import { type ComponentFixture, TestBed } from "@angular/core/testing";
import { StaffComponent } from "./staff.component";
describe("StaffComponent", () => {
let component: StaffComponent;
let fixture: ComponentFixture<StaffComponent>;
beforeEach(async() => {
await TestBed.configureTestingModule({
imports: [ StaffComponent ],
}).
compileComponents();
fixture = TestBed.createComponent(StaffComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it("should create", () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,26 +1,21 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { CommonModule } from "@angular/common"; import { CommonModule } from "@angular/common";
import { Component } from "@angular/core"; import { Component } from "@angular/core";
import { FormControl, ReactiveFormsModule } from "@angular/forms"; import { FormControl, ReactiveFormsModule } from "@angular/forms";
import { RouterModule } from "@angular/router"; import { RouterModule } from "@angular/router";
import { ApiService } from "../../api.service"; import type { Platform } from "@repo/types/prod/unions/platform.js";
import { ConsentComponent } from "../../consent/consent.component"; import type { ApiService } from "../../api.service.js";
import { ErrorComponent } from "../../error/error.component"; import { ConsentComponent } from "../../consent/consent.component.js";
import { CheckboxComponent } from "../../inputs/checkbox/checkbox.component"; import { ErrorComponent } from "../../error/error.component.js";
import { MultiLineComponent } import { CheckboxComponent } from "../../inputs/checkbox/checkbox.component.js";
from "../../inputs/multi-line/multi-line.component"; import { MultiLineComponent } from "../../inputs/multi-line/multi-line.component.js";
import { SelectMenuComponent } import { SelectMenuComponent } from "../../inputs/select-menu/select-menu.component.js";
from "../../inputs/select-menu/select-menu.component"; import { SingleLineComponent } from "../../inputs/single-line/single-line.component.js";
import { SingleLineComponent } import { SuccessComponent } from "../../success/success.component.js";
from "../../inputs/single-line/single-line.component"; import { UserinfoComponent } from "../../userinfo/userinfo.component.js";
import { SuccessComponent } from "../../success/success.component";
import { UserinfoComponent } from "../../userinfo/userinfo.component";
import type { Platform } from "@repo/types/prod/unions/platform";
/**
*
*/
@Component({ @Component({
imports: [ imports: [
RouterModule, RouterModule,
@ -35,8 +30,8 @@ import type { Platform } from "@repo/types/prod/unions/platform";
MultiLineComponent, MultiLineComponent,
SuccessComponent, SuccessComponent,
], ],
selector: "staff-form", selector: 'staff-form',
styleUrl: "./staff.component.css", styleUrl: './staff.component.css',
templateUrl: "./staff.component.html", templateUrl: "./staff.component.html",
}) })
export class StaffComponent { export class StaffComponent {
@ -62,27 +57,32 @@ export class StaffComponent {
public consent = new FormControl(false); public consent = new FormControl(false);
public constructor(private readonly apiService: ApiService) {} /**
* @param apiService
*/
constructor(private readonly apiService: ApiService) {}
// eslint-disable-next-line complexity -- stfu /**
public submit(event: MouseEvent): void { * @param e
*/
public submit(e: MouseEvent): void {
this.error = ""; this.error = "";
const { form } = event.target as HTMLButtonElement; const { form } = e.target as HTMLButtonElement;
const valid = form?.reportValidity(); const valid = form?.reportValidity();
if (valid !== true) { if (!valid) {
return; return;
} }
this.loading = true; this.loading = true;
this.apiService. this.apiService.
submitStaff({ submitStaff({
consent: this.consent.value ?? false,
currentBehaviour: this.currentBehaviour.value ?? undefined, currentBehaviour: this.currentBehaviour.value ?? undefined,
difficultSituation: this.difficultSituation.value ?? undefined,
email: this.email.value ?? undefined, email: this.email.value ?? undefined,
difficultSituation: this.difficultSituation.value ?? undefined,
firstName: this.firstName.value ?? undefined, firstName: this.firstName.value ?? undefined,
handlingTrauma: this.handlingTrauma.value ?? undefined, consent: this.consent.value ?? false,
internalConflict: this.internalConflict.value ?? undefined, internalConflict: this.internalConflict.value ?? undefined,
handlingTrauma: this.handlingTrauma.value ?? undefined,
lastName: this.lastName.value ?? undefined, lastName: this.lastName.value ?? undefined,
leadershipSituation: this.leadershipSituation.value ?? undefined, leadershipSituation: this.leadershipSituation.value ?? undefined,
platform: this.platform.value ?? undefined, platform: this.platform.value ?? undefined,
@ -91,9 +91,9 @@ export class StaffComponent {
understandVolunteer: this.understandVolunteer.value ?? false, understandVolunteer: this.understandVolunteer.value ?? false,
whyJoin: this.whyJoin.value ?? undefined, whyJoin: this.whyJoin.value ?? undefined,
}). }).
then((response) => { then((res) => {
if ("error" in response) { if ("error" in res) {
this.error = response.error; this.error = res.error;
this.loading = false; this.loading = false;
} else { } else {
this.error = ""; this.error = "";

View File

@ -0,0 +1,22 @@
import { type ComponentFixture, TestBed } from "@angular/core/testing";
import { HomeComponent } from "./home.component";
describe("HomeComponent", () => {
let component: HomeComponent;
let fixture: ComponentFixture<HomeComponent>;
beforeEach(async() => {
await TestBed.configureTestingModule({
imports: [ HomeComponent ],
}).
compileComponents();
fixture = TestBed.createComponent(HomeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it("should create", () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,15 +1,13 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { Component } from "@angular/core"; import { Component } from "@angular/core";
import { RouterModule } from "@angular/router"; import { RouterModule } from "@angular/router";
/**
*
*/
@Component({ @Component({
imports: [ RouterModule ], imports: [ RouterModule ],
selector: "app-home", selector: 'app-home',
styleUrl: "./home.component.css", styleUrl: './home.component.css',
templateUrl: "./home.component.html", templateUrl: "./home.component.html",
}) })
export class HomeComponent { export class HomeComponent {

View File

@ -0,0 +1,22 @@
import { type ComponentFixture, TestBed } from "@angular/core/testing";
import { CheckboxComponent } from "./checkbox.component";
describe("CheckboxComponent", () => {
let component: CheckboxComponent;
let fixture: ComponentFixture<CheckboxComponent>;
beforeEach(async() => {
await TestBed.configureTestingModule({
imports: [ CheckboxComponent ],
}).
compileComponents();
fixture = TestBed.createComponent(CheckboxComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it("should create", () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,15 +1,13 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { Component, input } from "@angular/core"; import { Component, input } from "@angular/core";
import { ReactiveFormsModule, type FormControl } from "@angular/forms"; import { ReactiveFormsModule, type FormControl } from "@angular/forms";
/**
*
*/
@Component({ @Component({
imports: [ ReactiveFormsModule ], imports: [ ReactiveFormsModule ],
selector: "app-checkbox", selector: 'app-checkbox',
styleUrl: "./checkbox.component.css", styleUrl: './checkbox.component.css',
templateUrl: "./checkbox.component.html", templateUrl: "./checkbox.component.html",
}) })
export class CheckboxComponent { export class CheckboxComponent {

View File

@ -0,0 +1,22 @@
import { type ComponentFixture, TestBed } from "@angular/core/testing";
import { MultiLineComponent } from "./multi-line.component";
describe("MultiLineComponent", () => {
let component: MultiLineComponent;
let fixture: ComponentFixture<MultiLineComponent>;
beforeEach(async() => {
await TestBed.configureTestingModule({
imports: [ MultiLineComponent ],
}).
compileComponents();
fixture = TestBed.createComponent(MultiLineComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it("should create", () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,16 +1,14 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { CommonModule } from "@angular/common"; import { CommonModule } from "@angular/common";
import { Component, input } from "@angular/core"; import { Component, input } from "@angular/core";
import { ReactiveFormsModule, type FormControl } from "@angular/forms"; import { ReactiveFormsModule, type FormControl } from "@angular/forms";
/**
*
*/
@Component({ @Component({
imports: [ CommonModule, ReactiveFormsModule ], imports: [ CommonModule, ReactiveFormsModule ],
selector: "app-multi-line", selector: 'app-multi-line',
styleUrl: "./multi-line.component.css", styleUrl: './multi-line.component.css',
templateUrl: "./multi-line.component.html", templateUrl: "./multi-line.component.html",
}) })
export class MultiLineComponent { export class MultiLineComponent {

View File

@ -0,0 +1,22 @@
import { type ComponentFixture, TestBed } from "@angular/core/testing";
import { SelectMenuComponent } from "./select-menu.component";
describe("SelectMenuComponent", () => {
let component: SelectMenuComponent;
let fixture: ComponentFixture<SelectMenuComponent>;
beforeEach(async() => {
await TestBed.configureTestingModule({
imports: [ SelectMenuComponent ],
}).
compileComponents();
fixture = TestBed.createComponent(SelectMenuComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it("should create", () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,16 +1,14 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { CommonModule } from "@angular/common"; import { CommonModule } from "@angular/common";
import { Component, input } from "@angular/core"; import { Component, input } from "@angular/core";
import { ReactiveFormsModule, type FormControl } from "@angular/forms"; import { ReactiveFormsModule, type FormControl } from "@angular/forms";
/**
*
*/
@Component({ @Component({
imports: [ CommonModule, ReactiveFormsModule ], imports: [ CommonModule, ReactiveFormsModule ],
selector: "app-select-menu", selector: 'app-select-menu',
styleUrl: "./select-menu.component.css", styleUrl: './select-menu.component.css',
templateUrl: "./select-menu.component.html", templateUrl: "./select-menu.component.html",
}) })
export class SelectMenuComponent { export class SelectMenuComponent {

View File

@ -0,0 +1,22 @@
import { type ComponentFixture, TestBed } from "@angular/core/testing";
import { SingleLineComponent } from "./single-line.component";
describe("SingleLineComponent", () => {
let component: SingleLineComponent;
let fixture: ComponentFixture<SingleLineComponent>;
beforeEach(async() => {
await TestBed.configureTestingModule({
imports: [ SingleLineComponent ],
}).
compileComponents();
fixture = TestBed.createComponent(SingleLineComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it("should create", () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,17 +1,14 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { CommonModule } from "@angular/common"; import { CommonModule } from "@angular/common";
import { Component, input } from "@angular/core"; import { Component, input } from "@angular/core";
import { type FormControl, ReactiveFormsModule } from "@angular/forms"; import { type FormControl, ReactiveFormsModule } from "@angular/forms";
/**
*
*/
@Component({ @Component({
imports: [ CommonModule, ReactiveFormsModule ], imports: [ CommonModule, ReactiveFormsModule ],
selector: "app-single-line", selector: 'app-single-line',
styleUrl: "./single-line.component.css", styleUrl: './single-line.component.css',
templateUrl: "./single-line.component.html", templateUrl: "./single-line.component.html",
}) })
export class SingleLineComponent { export class SingleLineComponent {

View File

@ -0,0 +1,22 @@
import { type ComponentFixture, TestBed } from "@angular/core/testing";
import { ReviewComponent } from "./review.component";
describe("ReviewComponent", () => {
let component: ReviewComponent;
let fixture: ComponentFixture<ReviewComponent>;
beforeEach(async() => {
await TestBed.configureTestingModule({
imports: [ ReviewComponent ],
}).
compileComponents();
fixture = TestBed.createComponent(ReviewComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it("should create", () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,18 +1,14 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
/* global localStorage -- this runs in the browser */
import { CommonModule } from "@angular/common"; import { CommonModule } from "@angular/common";
import { Component } from "@angular/core"; import { Component } from "@angular/core";
import { FormControl, ReactiveFormsModule } from "@angular/forms"; import { FormControl, ReactiveFormsModule } from "@angular/forms";
import { RouterModule } from "@angular/router"; import { RouterModule } from "@angular/router";
import { ApiService } from "../api.service"; import { ErrorComponent } from "../error/error.component.js";
import { ErrorComponent } from "../error/error.component"; import { SingleLineComponent } from "../inputs/single-line/single-line.component.js";
import { SingleLineComponent } import type { ApiService } from "../api.service.js";
from "../inputs/single-line/single-line.component";
/**
*
*/
@Component({ @Component({
imports: [ imports: [
CommonModule, CommonModule,
@ -21,17 +17,15 @@ import { SingleLineComponent }
SingleLineComponent, SingleLineComponent,
ErrorComponent, ErrorComponent,
], ],
selector: "app-review", selector: 'app-review',
styleUrl: "./review.component.css", styleUrl: './review.component.css',
templateUrl: "./review.component.html", templateUrl: "./review.component.html",
}) })
export class ReviewComponent { export class ReviewComponent {
public error = ""; public error = "";
public token = new FormControl(""); public token = new FormControl("");
public valid = false; public valid = false;
public data: Array<{ public data: Array<{ email: string; id: string; info: Array<{ key: string; value: unknown }> }> = [];
email: string; id: string; info: Array<{ key: string; value: unknown }>;
}> = [];
public view: public view:
| "" | ""
@ -43,40 +37,50 @@ export class ReviewComponent {
| "mentorships" | "mentorships"
| "staff" = ""; | "staff" = "";
public constructor(private readonly apiService: ApiService) { /**
* @param apiService
*/
constructor(private readonly apiService: ApiService) {
const storedToken = localStorage.getItem("token"); const storedToken = localStorage.getItem("token");
if (storedToken === null) { if (!storedToken) {
return; return;
} }
this.apiService.validateToken(storedToken). this.token.setValue(storedToken);
then((valid) => { this.valid = true;
if (valid) {
this.valid = true; /*
this.token.setValue(storedToken); * This.apiService
} else { * .validateToken(storedToken)
this.error = "The token found in local storage is invalid."; * .then((valid) => {
this.valid = false; * if (valid) {
} * this.valid = true;
}). * } else {
catch(() => { * this.error = 'The token found in local storage is invalid.';
// eslint-disable-next-line stylistic/max-len -- Long string * this.valid = false;
this.error = "An error occurred while validating the token found in local storage."; * }
this.valid = false; * })
}); * .catch(() => {
* this.error = 'An error occurred while validating your stored token.';
* this.valid = false;
* });
*/
} }
public submit(event: MouseEvent): void { /**
* @param e
*/
public submit(e: MouseEvent): void {
this.error = ""; this.error = "";
const { form } = event.target as HTMLButtonElement; const { form } = e.target as HTMLButtonElement;
const valid = form?.reportValidity(); const valid = form?.reportValidity();
if (valid !== true) { if (!valid) {
return; return;
} }
this.apiService. this.apiService.
validateToken(this.token.value). validateToken(this.token.value).
then((tokenValid) => { then((valid) => {
if (tokenValid) { if (valid) {
this.valid = true; this.valid = true;
localStorage.setItem("token", this.token.value as string); localStorage.setItem("token", this.token.value as string);
} else { } else {
@ -90,28 +94,25 @@ export class ReviewComponent {
}); });
} }
/**
* @param id
*/
public markReviewed(id: string): void { public markReviewed(id: string): void {
const view = this.view as const view = this.view as "appeals" | "commissions" | "contacts" | "events" | "meetings" | "mentorships" | "staff";
| "appeals" this.apiService.markReviewed(view, id, this.token.value!).then((data) => {
| "commissions" if ("error" in data) {
| "contacts" this.error = data.error;
| "events" } else {
| "meetings" this.data = this.data.filter((item) => {
| "mentorships" return item.id !== id;
| "staff"; });
void this.apiService. }
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- We know token is not null });
markReviewed(view, id, this.token.value!).then((data) => {
if ("error" in data) {
this.error = data.error;
} else {
this.data = this.data.filter((item) => {
return item.id !== id;
});
}
});
} }
/**
* @param view
*/
public setView( public setView(
view: view:
| "appeals" | "appeals"
@ -123,24 +124,17 @@ export class ReviewComponent {
| "staff", | "staff",
): void { ): void {
this.view = view; this.view = view;
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- We know token is not null this.apiService.getData(view, this.token.value!).then((data) => {
void this.apiService.getData(view, this.token.value!).then((data) => {
if ("error" in data) { if ("error" in data) {
this.error = data.error; this.error = data.error;
} else { } else {
this.data = (data.data as Array< this.data = (data.data as Array<
{ email: string; id: string } & Record<string, unknown> { email: string; id: string } & Record<string, unknown>
>).map((item) => { >).map((item) => {
const object: const object: { email: string; id: string; info: Array<{ key: string; value: unknown }> } = { email: item.email, id: item.id, info: [] };
{
email: string;
id: string;
info: Array<{ key: string; value: unknown }>;
}
= { email: item.email, id: item.id, info: [] };
for (const key in item) { for (const key in item) {
if (![ "email", "id" ].includes(key)) { if (![ "email", "id" ].includes(key)) {
object.info.push({ key: key, value: item[key] }); object.info.push({ key, value: item[key] });
} }
} }
return object; return object;

View File

@ -0,0 +1,22 @@
import { type ComponentFixture, TestBed } from "@angular/core/testing";
import { SuccessComponent } from "./success.component";
describe("SuccessComponent", () => {
let component: SuccessComponent;
let fixture: ComponentFixture<SuccessComponent>;
beforeEach(async() => {
await TestBed.configureTestingModule({
imports: [ SuccessComponent ],
}).
compileComponents();
fixture = TestBed.createComponent(SuccessComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it("should create", () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,15 +1,12 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { Component } from "@angular/core"; import { Component } from "@angular/core";
/**
*
*/
@Component({ @Component({
imports: [], imports: [],
selector: "app-success", selector: 'app-success',
styleUrl: "./success.component.css", styleUrl: './success.component.css',
templateUrl: "./success.component.html", templateUrl: "./success.component.html",
}) })
export class SuccessComponent { export class SuccessComponent {

View File

@ -0,0 +1,22 @@
import { type ComponentFixture, TestBed } from "@angular/core/testing";
import { UserinfoComponent } from "./userinfo.component";
describe("UserinfoComponent", () => {
let component: UserinfoComponent;
let fixture: ComponentFixture<UserinfoComponent>;
beforeEach(async() => {
await TestBed.configureTestingModule({
imports: [ UserinfoComponent ],
}).
compileComponents();
fixture = TestBed.createComponent(UserinfoComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it("should create", () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,18 +1,14 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { Component, input } from "@angular/core"; import { Component, input } from "@angular/core";
import { SingleLineComponent } import { SingleLineComponent } from "../inputs/single-line/single-line.component.js";
from "../inputs/single-line/single-line.component";
import type { FormControl } from "@angular/forms"; import type { FormControl } from "@angular/forms";
/**
*
*/
@Component({ @Component({
imports: [ SingleLineComponent ], imports: [ SingleLineComponent ],
selector: "app-userinfo", selector: 'app-userinfo',
styleUrl: "./userinfo.component.css", styleUrl: './userinfo.component.css',
templateUrl: "./userinfo.component.html", templateUrl: "./userinfo.component.html",
}) })
export class UserinfoComponent { export class UserinfoComponent {

View File

@ -1,15 +1,8 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { bootstrapApplication } from "@angular/platform-browser"; import { bootstrapApplication } from "@angular/platform-browser";
import { AppComponent } from "./app/app.component"; import { AppComponent } from "./app/app.component";
import { appConfig } from "./app/app.config"; import { appConfig } from "./app/app.config";
bootstrapApplication(AppComponent, appConfig). bootstrapApplication(AppComponent, appConfig).
// eslint-disable-next-line unicorn/prefer-top-level-await -- This is the entry point of the application. catch((error) => {
catch((error: unknown) => {
console.error(error); console.error(error);
}); });

15
client/tsconfig.app.json Normal file
View File

@ -0,0 +1,15 @@
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"files": [
"src/main.ts"
],
"include": [
"src/**/*.d.ts"
]
}

View File

@ -16,7 +16,7 @@
"moduleResolution": "bundler", "moduleResolution": "bundler",
"importHelpers": true, "importHelpers": true,
"target": "ES2022", "target": "ES2022",
"module": "ES2022", "module": "ES2022"
}, },
"angularCompilerOptions": { "angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false, "enableI18nLegacyMessageIdFormat": false,

15
client/tsconfig.spec.json Normal file
View File

@ -0,0 +1,15 @@
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/spec",
"types": [
"jasmine"
]
},
"include": [
"src/**/*.spec.ts",
"src/**/*.d.ts"
]
}

View File

@ -1,6 +1,6 @@
{ {
"name": "forms", "name": "forms",
"version": "1.0.0", "version": "0.0.0",
"description": "Application for managing and submitting our various forms!", "description": "Application for managing and submitting our various forms!",
"main": "index.js", "main": "index.js",
"packageManager": "pnpm@10.0.0", "packageManager": "pnpm@10.0.0",
@ -8,7 +8,7 @@
"build": "turbo build", "build": "turbo build",
"start": "turbo start", "start": "turbo start",
"lint": "turbo lint", "lint": "turbo lint",
"test": "turbo test" "test": "echo \"Error: no test specified\" && exit 0"
}, },
"keywords": [], "keywords": [],
"author": "", "author": "",

View File

@ -8,7 +8,7 @@
"scripts": { "scripts": {
"build": "tsc", "build": "tsc",
"lint": "eslint src --max-warnings 0", "lint": "eslint src --max-warnings 0",
"test": "echo \"Error: no test specified\" && exit 0" "test": "echo \"Error: no test specified\" && exit 1"
}, },
"keywords": [], "keywords": [],
"author": "", "author": "",

31
pnpm-lock.yaml generated
View File

@ -73,9 +73,6 @@ importers:
'@types/jasmine': '@types/jasmine':
specifier: ~5.1.0 specifier: ~5.1.0
version: 5.1.6 version: 5.1.6
eslint:
specifier: 9.20.1
version: 9.20.1(jiti@1.21.7)
jasmine-core: jasmine-core:
specifier: ~5.5.0 specifier: ~5.5.0
version: 5.5.0 version: 5.5.0
@ -118,9 +115,6 @@ importers:
server: server:
dependencies: dependencies:
'@fastify/cors':
specifier: 10.0.2
version: 10.0.2
'@nhcarrigan/logger': '@nhcarrigan/logger':
specifier: 1.0.0 specifier: 1.0.0
version: 1.0.0 version: 1.0.0
@ -1071,9 +1065,6 @@ packages:
'@fastify/ajv-compiler@4.0.2': '@fastify/ajv-compiler@4.0.2':
resolution: {integrity: sha512-Rkiu/8wIjpsf46Rr+Fitd3HRP+VsxUFDDeag0hs9L0ksfnwx2g7SPQQTFL0E8Qv+rfXzQOxBJnjUB9ITUDjfWQ==} resolution: {integrity: sha512-Rkiu/8wIjpsf46Rr+Fitd3HRP+VsxUFDDeag0hs9L0ksfnwx2g7SPQQTFL0E8Qv+rfXzQOxBJnjUB9ITUDjfWQ==}
'@fastify/cors@10.0.2':
resolution: {integrity: sha512-DGdxOG36sS/tZv1NFiCJGi7wGuXOSPL2CmNX5PbOVKx0C6LuIALRMrqLByHTCcX1Rbl8NJ9IWlJex32bzydvlw==}
'@fastify/error@4.0.0': '@fastify/error@4.0.0':
resolution: {integrity: sha512-OO/SA8As24JtT1usTUTKgGH7uLvhfwZPwlptRi2Dp5P4KKmJI3gvsZ8MIHnNwDs4sLf/aai5LzTyl66xr7qMxA==} resolution: {integrity: sha512-OO/SA8As24JtT1usTUTKgGH7uLvhfwZPwlptRi2Dp5P4KKmJI3gvsZ8MIHnNwDs4sLf/aai5LzTyl66xr7qMxA==}
@ -3143,9 +3134,6 @@ packages:
fast-uri@3.0.6: fast-uri@3.0.6:
resolution: {integrity: sha512-Atfo14OibSv5wAp4VWNsFYE1AchQRTv9cBGWET4pZWHzYshFSS9NQI6I57rdKn9croWVMbYFbLhJ+yJvmZIIHw==} resolution: {integrity: sha512-Atfo14OibSv5wAp4VWNsFYE1AchQRTv9cBGWET4pZWHzYshFSS9NQI6I57rdKn9croWVMbYFbLhJ+yJvmZIIHw==}
fastify-plugin@5.0.1:
resolution: {integrity: sha512-HCxs+YnRaWzCl+cWRYFnHmeRFyR5GVnJTAaCJQiYzQSDwK9MgJdyAsuL3nh0EWRCYMgQ5MeziymvmAhUHYHDUQ==}
fastify@5.2.1: fastify@5.2.1:
resolution: {integrity: sha512-rslrNBF67eg8/Gyn7P2URV8/6pz8kSAscFL4EThZJ8JBMaXacVdVE4hmUcnPNKERl5o/xTiBSLfdowBRhVF1WA==} resolution: {integrity: sha512-rslrNBF67eg8/Gyn7P2URV8/6pz8kSAscFL4EThZJ8JBMaXacVdVE4hmUcnPNKERl5o/xTiBSLfdowBRhVF1WA==}
@ -4109,9 +4097,6 @@ packages:
engines: {node: '>=10'} engines: {node: '>=10'}
hasBin: true hasBin: true
mnemonist@0.39.8:
resolution: {integrity: sha512-vyWo2K3fjrUw8YeeZ1zF0fy6Mu59RHokURlld8ymdUPjMlD9EC9ov1/YPqTgqRvUN9nTr3Gqfz29LYAmu0PHPQ==}
mrmime@2.0.0: mrmime@2.0.0:
resolution: {integrity: sha512-eu38+hdgojoyq63s+yTpN4XMBdt5l8HhMhc4VKLO9KM5caLIBvUm4thi7fFaxyTmCKeNnXZ5pAlBwCUnhA09uw==} resolution: {integrity: sha512-eu38+hdgojoyq63s+yTpN4XMBdt5l8HhMhc4VKLO9KM5caLIBvUm4thi7fFaxyTmCKeNnXZ5pAlBwCUnhA09uw==}
engines: {node: '>=10'} engines: {node: '>=10'}
@ -4274,9 +4259,6 @@ packages:
resolution: {integrity: sha512-gXah6aZrcUxjWg2zR2MwouP2eHlCBzdV4pygudehaKXSGW4v2AsRQUK+lwwXhii6KFZcunEnmSUoYp5CXibxtA==} resolution: {integrity: sha512-gXah6aZrcUxjWg2zR2MwouP2eHlCBzdV4pygudehaKXSGW4v2AsRQUK+lwwXhii6KFZcunEnmSUoYp5CXibxtA==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
obliterator@2.0.5:
resolution: {integrity: sha512-42CPE9AhahZRsMNslczq0ctAEtqk8Eka26QofnqC346BZdHDySk3LWka23LI7ULIw11NmltpiLagIq8gBozxTw==}
obuf@1.1.2: obuf@1.1.2:
resolution: {integrity: sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==} resolution: {integrity: sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==}
@ -6873,11 +6855,6 @@ snapshots:
ajv-formats: 3.0.1(ajv@8.17.1) ajv-formats: 3.0.1(ajv@8.17.1)
fast-uri: 3.0.6 fast-uri: 3.0.6
'@fastify/cors@10.0.2':
dependencies:
fastify-plugin: 5.0.1
mnemonist: 0.39.8
'@fastify/error@4.0.0': {} '@fastify/error@4.0.0': {}
'@fastify/fast-json-stringify-compiler@5.0.2': '@fastify/fast-json-stringify-compiler@5.0.2':
@ -9172,8 +9149,6 @@ snapshots:
fast-uri@3.0.6: {} fast-uri@3.0.6: {}
fastify-plugin@5.0.1: {}
fastify@5.2.1: fastify@5.2.1:
dependencies: dependencies:
'@fastify/ajv-compiler': 4.0.2 '@fastify/ajv-compiler': 4.0.2
@ -10216,10 +10191,6 @@ snapshots:
mkdirp@3.0.1: {} mkdirp@3.0.1: {}
mnemonist@0.39.8:
dependencies:
obliterator: 2.0.5
mrmime@2.0.0: {} mrmime@2.0.0: {}
ms@2.0.0: {} ms@2.0.0: {}
@ -10403,8 +10374,6 @@ snapshots:
define-properties: 1.2.1 define-properties: 1.2.1
es-object-atoms: 1.1.1 es-object-atoms: 1.1.1
obliterator@2.0.5: {}
obuf@1.1.2: {} obuf@1.1.2: {}
on-exit-leak-free@2.1.2: {} on-exit-leak-free@2.1.2: {}

View File

@ -24,7 +24,6 @@
"typescript": "5.7.3" "typescript": "5.7.3"
}, },
"dependencies": { "dependencies": {
"@fastify/cors": "10.0.2",
"@nhcarrigan/logger": "1.0.0", "@nhcarrigan/logger": "1.0.0",
"@prisma/client": "6.3.1", "@prisma/client": "6.3.1",
"fastify": "5.2.1", "fastify": "5.2.1",

View File

@ -29,8 +29,7 @@ export const listHandler = async(
}), }),
}); });
} catch (error) { } catch (error) {
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- we bein' lazy. await logger.error(`/list/${route}`, error);
await logger.error(`/list/${route}`, error as Error);
await response.status(500).send({ error: error instanceof Error await response.status(500).send({ error: error instanceof Error
? error.message ? error.message
: "Internal Server Error" }); : "Internal Server Error" });

View File

@ -47,8 +47,7 @@ export const reviewHandler = async(
await markSubmissionReviewed(database, route, submissionId); await markSubmissionReviewed(database, route, submissionId);
await response.code(200).send({ success: true }); await response.code(200).send({ success: true });
} catch (error) { } catch (error) {
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- we bein' lazy. await logger.error(`/review/${route}`, error);
await logger.error(`/review/${route}`, error as Error);
await response.status(500).send({ error: error instanceof Error await response.status(500).send({ error: error instanceof Error
? error.message ? error.message
: "Internal Server Error" }); : "Internal Server Error" });

View File

@ -53,8 +53,7 @@ export const submitAppealHandler = async(
await sendMail("appeal", data); await sendMail("appeal", data);
await response.send({ success: true }); await response.send({ success: true });
} catch (error) { } catch (error) {
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- we bein' lazy. await logger.error("/submit/appeals", error);
await logger.error("/submit/appeals", error as Error);
await response.status(500).send({ error: error instanceof Error await response.status(500).send({ error: error instanceof Error
? error.message ? error.message
: "Internal Server Error" }); : "Internal Server Error" });

View File

@ -55,8 +55,7 @@ export const submitCommissionHandler = async(
await sendMail("commissions", data); await sendMail("commissions", data);
await response.send({ success: true }); await response.send({ success: true });
} catch (error) { } catch (error) {
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- we bein' lazy. await logger.error("/submit/commissions", error);
await logger.error("/submit/commissions", error as Error);
await response.status(500).send({ error: error instanceof Error await response.status(500).send({ error: error instanceof Error
? error.message ? error.message
: "Internal Server Error" }); : "Internal Server Error" });

View File

@ -55,8 +55,7 @@ export const submitContactHandler = async(
await sendMail("contact", data); await sendMail("contact", data);
await response.send({ success: true }); await response.send({ success: true });
} catch (error) { } catch (error) {
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- we bein' lazy. await logger.error("/submit/contacts", error);
await logger.error("/submit/contacts", error as Error);
await response.status(500).send({ error: error instanceof Error await response.status(500).send({ error: error instanceof Error
? error.message ? error.message
: "Internal Server Error" }); : "Internal Server Error" });

View File

@ -55,8 +55,7 @@ export const submitEventHandler = async(
await sendMail("event", data); await sendMail("event", data);
await response.send({ success: true }); await response.send({ success: true });
} catch (error) { } catch (error) {
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- we bein' lazy. await logger.error("/submit/events", error);
await logger.error("/submit/events", error as Error);
await response.status(500).send({ error: error instanceof Error await response.status(500).send({ error: error instanceof Error
? error.message ? error.message
: "Internal Server Error" }); : "Internal Server Error" });

View File

@ -55,8 +55,7 @@ export const submitMeetingHandler = async(
await sendMail("meeting", data); await sendMail("meeting", data);
await response.send({ success: true }); await response.send({ success: true });
} catch (error) { } catch (error) {
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- we bein' lazy. await logger.error("/submit/meetings", error);
await logger.error("/submit/meetings", error as Error);
await response.status(500).send({ error: error instanceof Error await response.status(500).send({ error: error instanceof Error
? error.message ? error.message
: "Internal Server Error" }); : "Internal Server Error" });

View File

@ -55,8 +55,7 @@ export const submitMentorshipHandler = async(
await sendMail("mentorship", data); await sendMail("mentorship", data);
await response.send({ success: true }); await response.send({ success: true });
} catch (error) { } catch (error) {
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- we bein' lazy. await logger.error("/submit/mentorships", error);
await logger.error("/submit/mentorships", error as Error);
await response.status(500).send({ error: error instanceof Error await response.status(500).send({ error: error instanceof Error
? error.message ? error.message
: "Internal Server Error" }); : "Internal Server Error" });

View File

@ -55,8 +55,7 @@ export const submitStaffHandler = async(
await sendMail("staff", data); await sendMail("staff", data);
await response.send({ success: true }); await response.send({ success: true });
} catch (error) { } catch (error) {
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- we bein' lazy. await logger.error("/submit/staff", error);
await logger.error("/submit/staff", error as Error);
await response.status(500).send({ error: error instanceof Error await response.status(500).send({ error: error instanceof Error
? error.message ? error.message
: "Internal Server Error" }); : "Internal Server Error" });

View File

@ -4,7 +4,6 @@
* @author Naomi Carrigan * @author Naomi Carrigan
*/ */
import cors from "@fastify/cors";
import { PrismaClient } from "@prisma/client"; import { PrismaClient } from "@prisma/client";
import fastify from "fastify"; import fastify from "fastify";
import { authHook } from "./hooks/auth.js"; import { authHook } from "./hooks/auth.js";
@ -26,10 +25,6 @@ try {
logger: false, logger: false,
}); });
server.register(cors, {
origin: "*",
});
server.addHook("preHandler", authHook); server.addHook("preHandler", authHook);
server.addHook("preHandler", corsHook); server.addHook("preHandler", corsHook);

View File

@ -5,10 +5,6 @@
"dependsOn": ["^lint"], "dependsOn": ["^lint"],
"outputs": ["prod/**"] "outputs": ["prod/**"]
}, },
"test": {
"dependsOn": [],
"outputs": []
},
"lint": { "lint": {
"dependsOn": [], "dependsOn": [],
"outputs": [] "outputs": []