generated from nhcarrigan/template
Compare commits
2 Commits
chore/remo
...
2f08f1ed18
Author | SHA1 | Date | |
---|---|---|---|
2f08f1ed18
|
|||
107f54d269
|
@ -28,12 +28,6 @@ jobs:
|
||||
- name: Install Dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Build internal package
|
||||
run: cd packages/types && pnpm build
|
||||
|
||||
- name: Install again
|
||||
run: pnpm install
|
||||
|
||||
- name: Lint Source Files
|
||||
run: pnpm run lint
|
||||
|
||||
@ -41,4 +35,4 @@ jobs:
|
||||
run: pnpm run build
|
||||
|
||||
- name: Run Tests
|
||||
run: pnpm run test
|
||||
run: pnpm run test:ci
|
@ -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"
|
@ -19,7 +19,7 @@
|
||||
"polyfills": [
|
||||
"zone.js"
|
||||
],
|
||||
"tsConfig": "tsconfig.json",
|
||||
"tsConfig": "tsconfig.app.json",
|
||||
"assets": [
|
||||
{
|
||||
"glob": "**/*",
|
||||
@ -69,6 +69,26 @@
|
||||
},
|
||||
"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": []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,21 +2,4 @@ import NaomisConfig from "@nhcarrigan/eslint-config";
|
||||
|
||||
export default [
|
||||
...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"
|
||||
},
|
||||
},
|
||||
]
|
@ -6,7 +6,7 @@
|
||||
"dev": "ng dev",
|
||||
"lint": "eslint src --max-warnings 0",
|
||||
"build": "ng build",
|
||||
"test": "echo \"Error: no test specified\" && exit 0"
|
||||
"test": "ng test"
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
@ -27,15 +27,14 @@
|
||||
"@angular/cli": "^19.1.7",
|
||||
"@angular/compiler-cli": "^19.1.0",
|
||||
"@nhcarrigan/eslint-config": "5.2.0",
|
||||
"@repo/types": "../packages/types",
|
||||
"@types/jasmine": "~5.1.0",
|
||||
"eslint": "9.20.1",
|
||||
"jasmine-core": "~5.5.0",
|
||||
"karma": "~6.4.0",
|
||||
"karma-chrome-launcher": "~3.2.0",
|
||||
"karma-coverage": "~2.2.0",
|
||||
"karma-jasmine": "~5.1.0",
|
||||
"karma-jasmine-html-reporter": "~2.1.0",
|
||||
"typescript": "~5.7.2"
|
||||
"typescript": "~5.7.2",
|
||||
"@repo/types": "../packages/types"
|
||||
}
|
||||
}
|
||||
|
15
client/src/app/api.service.spec.ts
Normal file
15
client/src/app/api.service.spec.ts
Normal 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();
|
||||
});
|
||||
});
|
@ -1,39 +1,30 @@
|
||||
/**
|
||||
* @copyright nhcarrigan
|
||||
* @license Naomi's Public License
|
||||
* @author Naomi Carrigan
|
||||
*/
|
||||
|
||||
import { Injectable } from "@angular/core";
|
||||
import type {
|
||||
Appeal,
|
||||
Commission,
|
||||
Contact,
|
||||
ErrorResponse,
|
||||
Event,
|
||||
Meeting,
|
||||
Mentorship,
|
||||
SuccessResponse,
|
||||
Staff,
|
||||
DataResponse,
|
||||
Testimonial,
|
||||
} from "@repo/types";
|
||||
import type { Appeal, Commission, Contact, ErrorResponse, Event, Meeting, Mentorship, SuccessResponse, Staff, DataResponse } from "@repo/types";
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Injectable({
|
||||
providedIn: "root",
|
||||
})
|
||||
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> {
|
||||
if (token === null) {
|
||||
if (!token) {
|
||||
return false;
|
||||
}
|
||||
const ipRequest = await fetch("https://api.ipify.org?format=json");
|
||||
const ipResult = await ipRequest.json() as { ip: string };
|
||||
const { ip } = ipResult;
|
||||
const ipRes = await ipRequest.json();
|
||||
const { ip } = ipRes;
|
||||
const request = await fetch(`${this.url}/validate-token`, {
|
||||
body: JSON.stringify({ ip, token }),
|
||||
headers: {
|
||||
@ -41,13 +32,14 @@ export class ApiService {
|
||||
},
|
||||
method: "POST",
|
||||
});
|
||||
const response = await request.json() as { valid: boolean };
|
||||
const response = await request.json();
|
||||
return response.valid;
|
||||
}
|
||||
|
||||
public async submitAppeal(
|
||||
appeal: Partial<Appeal>,
|
||||
): Promise<SuccessResponse | ErrorResponse> {
|
||||
/**
|
||||
* @param appeal
|
||||
*/
|
||||
public async submitAppeal(appeal: Partial<Appeal>): Promise<SuccessResponse | ErrorResponse> {
|
||||
const request = await fetch(`${this.url}/submit/appeals`, {
|
||||
body: JSON.stringify(appeal),
|
||||
headers: {
|
||||
@ -55,13 +47,14 @@ export class ApiService {
|
||||
},
|
||||
method: "POST",
|
||||
});
|
||||
const response = await request.json() as SuccessResponse | ErrorResponse;
|
||||
const response = await request.json();
|
||||
return response;
|
||||
}
|
||||
|
||||
public async submitCommission(
|
||||
commission: Partial<Commission>,
|
||||
): Promise<SuccessResponse | ErrorResponse> {
|
||||
/**
|
||||
* @param commission
|
||||
*/
|
||||
public async submitCommission(commission: Partial<Commission>): Promise<SuccessResponse | ErrorResponse> {
|
||||
const request = await fetch(`${this.url}/submit/commissions`, {
|
||||
body: JSON.stringify(commission),
|
||||
headers: {
|
||||
@ -69,13 +62,14 @@ export class ApiService {
|
||||
},
|
||||
method: "POST",
|
||||
});
|
||||
const response = await request.json() as SuccessResponse | ErrorResponse;
|
||||
const response = await request.json();
|
||||
return response;
|
||||
}
|
||||
|
||||
public async submitContact(
|
||||
contact: Partial<Contact>,
|
||||
): Promise<SuccessResponse | ErrorResponse> {
|
||||
/**
|
||||
* @param contact
|
||||
*/
|
||||
public async submitContact(contact: Partial<Contact>): Promise<SuccessResponse | ErrorResponse> {
|
||||
const request = await fetch(`${this.url}/submit/contacts`, {
|
||||
body: JSON.stringify(contact),
|
||||
headers: {
|
||||
@ -83,13 +77,14 @@ export class ApiService {
|
||||
},
|
||||
method: "POST",
|
||||
});
|
||||
const response = await request.json() as SuccessResponse | ErrorResponse;
|
||||
const response = await request.json();
|
||||
return response;
|
||||
}
|
||||
|
||||
public async submitEvent(
|
||||
event: Partial<Event>,
|
||||
): Promise<SuccessResponse | ErrorResponse> {
|
||||
/**
|
||||
* @param event
|
||||
*/
|
||||
public async submitEvent(event: Partial<Event>): Promise<SuccessResponse | ErrorResponse> {
|
||||
const request = await fetch(`${this.url}/submit/events`, {
|
||||
body: JSON.stringify(event),
|
||||
headers: {
|
||||
@ -97,13 +92,14 @@ export class ApiService {
|
||||
},
|
||||
method: "POST",
|
||||
});
|
||||
const response = await request.json() as SuccessResponse | ErrorResponse;
|
||||
const response = await request.json();
|
||||
return response;
|
||||
}
|
||||
|
||||
public async submitMeeting(
|
||||
meeting: Partial<Meeting>,
|
||||
): Promise<SuccessResponse | ErrorResponse> {
|
||||
/**
|
||||
* @param meeting
|
||||
*/
|
||||
public async submitMeeting(meeting: Partial<Meeting>): Promise<SuccessResponse | ErrorResponse> {
|
||||
const request = await fetch(`${this.url}/submit/meetings`, {
|
||||
body: JSON.stringify(meeting),
|
||||
headers: {
|
||||
@ -111,13 +107,14 @@ export class ApiService {
|
||||
},
|
||||
method: "POST",
|
||||
});
|
||||
const response = await request.json() as SuccessResponse | ErrorResponse;
|
||||
const response = await request.json();
|
||||
return response;
|
||||
}
|
||||
|
||||
public async submitMentorship(
|
||||
mentorship: Partial<Mentorship>,
|
||||
): Promise<SuccessResponse | ErrorResponse> {
|
||||
/**
|
||||
* @param mentorship
|
||||
*/
|
||||
public async submitMentorship(mentorship: Partial<Mentorship>): Promise<SuccessResponse | ErrorResponse> {
|
||||
const request = await fetch(`${this.url}/submit/mentorships`, {
|
||||
body: JSON.stringify(mentorship),
|
||||
headers: {
|
||||
@ -125,13 +122,14 @@ export class ApiService {
|
||||
},
|
||||
method: "POST",
|
||||
});
|
||||
const response = await request.json() as SuccessResponse | ErrorResponse;
|
||||
const response = await request.json();
|
||||
return response;
|
||||
}
|
||||
|
||||
public async submitStaff(
|
||||
staff: Partial<Staff>,
|
||||
): Promise<SuccessResponse | ErrorResponse> {
|
||||
/**
|
||||
* @param staff
|
||||
*/
|
||||
public async submitStaff(staff: Partial<Staff>): Promise<SuccessResponse | ErrorResponse> {
|
||||
const request = await fetch(`${this.url}/submit/staff`, {
|
||||
body: JSON.stringify(staff),
|
||||
headers: {
|
||||
@ -139,36 +137,15 @@ export class ApiService {
|
||||
},
|
||||
method: "POST",
|
||||
});
|
||||
const response = await request.json() as SuccessResponse | ErrorResponse;
|
||||
const response = await request.json();
|
||||
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(
|
||||
type:
|
||||
| "appeals"
|
||||
| "commissions"
|
||||
| "contacts"
|
||||
| "events"
|
||||
| "meetings"
|
||||
| "mentorships"
|
||||
| "staff"
|
||||
| "testimonials",
|
||||
token: string,
|
||||
): Promise<DataResponse | ErrorResponse> {
|
||||
/**
|
||||
* @param type
|
||||
* @param token
|
||||
*/
|
||||
public async getData(type: "appeals" | "commissions" | "contacts" | "events" | "meetings" | "mentorships" | "staff", token: string): Promise<DataResponse | ErrorResponse> {
|
||||
const request = await fetch(`${this.url}/list/${type}`, {
|
||||
headers: {
|
||||
"Authorization": token,
|
||||
@ -176,23 +153,16 @@ export class ApiService {
|
||||
},
|
||||
method: "GET",
|
||||
});
|
||||
const response = await request.json() as DataResponse | ErrorResponse;
|
||||
const response = await request.json();
|
||||
return response;
|
||||
}
|
||||
|
||||
public async markReviewed(
|
||||
type:
|
||||
| "appeals"
|
||||
| "commissions"
|
||||
| "contacts"
|
||||
| "events"
|
||||
| "meetings"
|
||||
| "mentorships"
|
||||
| "staff"
|
||||
| "testimonials",
|
||||
id: string,
|
||||
token: string,
|
||||
): Promise<SuccessResponse | ErrorResponse> {
|
||||
/**
|
||||
* @param type
|
||||
* @param id
|
||||
* @param token
|
||||
*/
|
||||
public async markReviewed(type: "appeals" | "commissions" | "contacts" | "events" | "meetings" | "mentorships" | "staff", id: string, token: string): Promise<SuccessResponse | ErrorResponse> {
|
||||
const request = await fetch(`${this.url}/review/${type}`, {
|
||||
body: JSON.stringify({ submissionId: id }),
|
||||
headers: {
|
||||
@ -201,7 +171,7 @@ export class ApiService {
|
||||
},
|
||||
method: "PUT",
|
||||
});
|
||||
const response = await request.json() as SuccessResponse | ErrorResponse;
|
||||
const response = await request.json();
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
29
client/src/app/app.component.spec.ts
Normal file
29
client/src/app/app.component.spec.ts
Normal 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");
|
||||
});
|
||||
});
|
@ -1,18 +1,15 @@
|
||||
/**
|
||||
* @copyright nhcarrigan
|
||||
* @license Naomi's Public License
|
||||
* @author Naomi Carrigan
|
||||
*/
|
||||
|
||||
import { Component } from "@angular/core";
|
||||
import { RouterOutlet } from "@angular/router";
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Component({
|
||||
imports: [ RouterOutlet ],
|
||||
selector: "app-root",
|
||||
styleUrl: "./app.component.css",
|
||||
selector: 'app-root',
|
||||
styleUrl: './app.component.css',
|
||||
templateUrl: "./app.component.html",
|
||||
})
|
||||
export class AppComponent {
|
||||
public title = "NHCarrigan Forms";
|
||||
title = "NHCarrigan Forms";
|
||||
}
|
||||
|
@ -1,17 +1,7 @@
|
||||
/**
|
||||
* @copyright nhcarrigan
|
||||
* @license Naomi's Public License
|
||||
* @author Naomi Carrigan
|
||||
*/
|
||||
|
||||
import { type ApplicationConfig, provideZoneChangeDetection }
|
||||
from "@angular/core";
|
||||
import { type ApplicationConfig, provideZoneChangeDetection } from "@angular/core";
|
||||
import { provideRouter } from "@angular/router";
|
||||
import { routes } from "./app.routes";
|
||||
|
||||
export const appConfig: ApplicationConfig = {
|
||||
providers: [
|
||||
provideZoneChangeDetection({ eventCoalescing: true }),
|
||||
provideRouter(routes),
|
||||
],
|
||||
providers: [ provideZoneChangeDetection({ eventCoalescing: true }), provideRouter(routes) ],
|
||||
};
|
||||
|
@ -1,20 +1,10 @@
|
||||
/**
|
||||
* @copyright nhcarrigan
|
||||
* @license Naomi's Public License
|
||||
* @author Naomi Carrigan
|
||||
*/
|
||||
|
||||
import { AppealComponent } from "./forms/appeal/appeal.component.js";
|
||||
import { CommissionComponent }
|
||||
from "./forms/commission/commission.component.js";
|
||||
import { CommissionComponent } from "./forms/commission/commission.component.js";
|
||||
import { ContactComponent } from "./forms/contact/contact.component.js";
|
||||
import { EventComponent } from "./forms/event/event.component.js";
|
||||
import { MeetingComponent } from "./forms/meeting/meeting.component.js";
|
||||
import { MentorshipComponent }
|
||||
from "./forms/mentorship/mentorship.component.js";
|
||||
import { MentorshipComponent } from "./forms/mentorship/mentorship.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 { ReviewComponent } from "./review/review.component.js";
|
||||
import type { Routes } from "@angular/router";
|
||||
@ -29,5 +19,4 @@ export const routes: Routes = [
|
||||
{ component: MentorshipComponent, path: "mentorship" },
|
||||
{ component: StaffComponent, path: "staff" },
|
||||
{ component: ReviewComponent, path: "review" },
|
||||
{ component: TestimonialComponent, path: "testimonial" },
|
||||
];
|
||||
|
22
client/src/app/consent/consent.component.spec.ts
Normal file
22
client/src/app/consent/consent.component.spec.ts
Normal 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();
|
||||
});
|
||||
});
|
@ -1,15 +1,13 @@
|
||||
/**
|
||||
* @copyright nhcarrigan
|
||||
* @license Naomi's Public License
|
||||
* @author Naomi Carrigan
|
||||
*/
|
||||
import { Component, input } from "@angular/core";
|
||||
import { type FormControl, ReactiveFormsModule } from "@angular/forms";
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Component({
|
||||
imports: [ ReactiveFormsModule ],
|
||||
selector: "app-consent",
|
||||
styleUrl: "./consent.component.css",
|
||||
selector: 'app-consent',
|
||||
styleUrl: './consent.component.css',
|
||||
templateUrl: "./consent.component.html",
|
||||
})
|
||||
export class ConsentComponent {
|
||||
|
22
client/src/app/error/error.component.spec.ts
Normal file
22
client/src/app/error/error.component.spec.ts
Normal 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();
|
||||
});
|
||||
});
|
@ -1,14 +1,12 @@
|
||||
/**
|
||||
* @copyright nhcarrigan
|
||||
* @license Naomi's Public License
|
||||
* @author Naomi Carrigan
|
||||
*/
|
||||
import { Component, input } from "@angular/core";
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Component({
|
||||
imports: [],
|
||||
selector: "app-error",
|
||||
styleUrl: "./error.component.css",
|
||||
selector: 'app-error',
|
||||
styleUrl: './error.component.css',
|
||||
templateUrl: "./error.component.html",
|
||||
})
|
||||
export class ErrorComponent {
|
||||
|
@ -7,18 +7,18 @@
|
||||
<app-userinfo [firstNameControl]="firstName" [lastNameControl]="lastName" [emailControl]="email" [companyControl]="company"></app-userinfo>
|
||||
<app-checkbox [control]="understandBinding" label="I understand that the decision made by the appeals team is final and binding. If my appeal is denied, I agree that I cannot appeal again."></app-checkbox>
|
||||
<div class="two-col">
|
||||
<app-select-menu label="What sanction was levied against you?:" options="reminder,warning,temporary removal,permanent removal" [control]="sanctionType"></app-select-menu>
|
||||
<app-single-line label="What is your moderation case number?:" type="number" [control]="caseNumber"></app-single-line>
|
||||
<app-select-menu label="What sanction was levied against you?" options="reminder,warning,temporary removal,permanent removal" [control]="sanctionType"></app-select-menu>
|
||||
<app-single-line label="What is your moderation case number?" type="number" [control]="caseNumber"></app-single-line>
|
||||
</div>
|
||||
<div class="two-col">
|
||||
<app-select-menu label="What platform were you sanctioned on?:" options="Forum,IRC,Matrix,Gitea,Fediverse" [control]="sanctionPlatform"></app-select-menu>
|
||||
<app-single-line label="What is your username on that platform?:" type="text" [control]="platformUsername"></app-single-line>
|
||||
<app-select-menu label="What platform were you sanctioned on?" options="Forum,IRC,Matrix,Gitea,Fediverse" [control]="sanctionPlatform"></app-select-menu>
|
||||
<app-single-line label="What is your username on that platform?" type="text" [control]="platformUsername"></app-single-line>
|
||||
</div>
|
||||
<app-multi-line label="Why were you sanctioned? Use your own words. Do NOT copy the sanction reason you were provided by our team.:" [control]="sanctionReason"></app-multi-line>
|
||||
<app-multi-line label="Do you feel the sanction was fair? Why or why not?:" [control]="sanctionFair"></app-multi-line>
|
||||
<app-multi-line label="How did your behaviour violate our Code of Conduct, Community Guidelines, or other policies?:" [control]="behaviourViolation"></app-multi-line>
|
||||
<app-multi-line label="Why do you feel this sanction should be revoked?:" [control]="appealReason"></app-multi-line>
|
||||
<app-multi-line label="How will you improve your conduct to prevent future sanctions?:" [control]="behaviourImprove"></app-multi-line>
|
||||
<app-multi-line label="Why were you sanctioned? Use your own words. Do NOT copy the sanction reason you were provided by our team." [control]="sanctionReason"></app-multi-line>
|
||||
<app-multi-line label="Do you feel the sanction was fair? Why or why not?" [control]="sanctionFair"></app-multi-line>
|
||||
<app-multi-line label="How did your behaviour violate our Code of Conduct, Community Guidelines, or other policies?" [control]="behaviourViolation"></app-multi-line>
|
||||
<app-multi-line label="Why do you feel this sanction should be revoked?" [control]="appealReason"></app-multi-line>
|
||||
<app-multi-line label="How will you improve your conduct to prevent future sanctions?" [control]="behaviourImprove"></app-multi-line>
|
||||
<app-consent [control]="consent"></app-consent>
|
||||
<button type="button" (click)="submit($event)">Submit</button>
|
||||
</form>
|
||||
|
22
client/src/app/forms/appeal/appeal.component.spec.ts
Normal file
22
client/src/app/forms/appeal/appeal.component.spec.ts
Normal 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();
|
||||
});
|
||||
});
|
@ -1,27 +1,22 @@
|
||||
/**
|
||||
* @copyright nhcarrigan
|
||||
* @license Naomi's Public License
|
||||
* @author Naomi Carrigan
|
||||
*/
|
||||
import { CommonModule } from "@angular/common";
|
||||
import { Component } from "@angular/core";
|
||||
import { ReactiveFormsModule, FormControl } from "@angular/forms";
|
||||
import { RouterModule } from "@angular/router";
|
||||
import { ApiService } from "../../api.service";
|
||||
import { ConsentComponent } from "../../consent/consent.component";
|
||||
import { ErrorComponent } from "../../error/error.component";
|
||||
import { CheckboxComponent } from "../../inputs/checkbox/checkbox.component";
|
||||
import { MultiLineComponent }
|
||||
from "../../inputs/multi-line/multi-line.component";
|
||||
import { SelectMenuComponent }
|
||||
from "../../inputs/select-menu/select-menu.component";
|
||||
import { SingleLineComponent }
|
||||
from "../../inputs/single-line/single-line.component";
|
||||
import { SuccessComponent } from "../../success/success.component";
|
||||
import { UserinfoComponent } from "../../userinfo/userinfo.component";
|
||||
import type { Platform } from "@repo/types/prod/unions/platform";
|
||||
import type { Sanction } from "@repo/types/prod/unions/sanction";
|
||||
import { ConsentComponent } from "../../consent/consent.component.js";
|
||||
import { ErrorComponent } from "../../error/error.component.js";
|
||||
import { CheckboxComponent } from "../../inputs/checkbox/checkbox.component.js";
|
||||
import { MultiLineComponent } from "../../inputs/multi-line/multi-line.component.js";
|
||||
import { SelectMenuComponent } from "../../inputs/select-menu/select-menu.component.js";
|
||||
import { SingleLineComponent } from "../../inputs/single-line/single-line.component.js";
|
||||
import { SuccessComponent } from "../../success/success.component.js";
|
||||
import { UserinfoComponent } from "../../userinfo/userinfo.component.js";
|
||||
import type { ApiService } from "../../api.service.js";
|
||||
import type { Platform } from "@repo/types/prod/unions/platform.js";
|
||||
import type { Sanction } from "@repo/types/prod/unions/sanction.js";
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Component({
|
||||
imports: [
|
||||
RouterModule,
|
||||
@ -36,8 +31,8 @@ import type { Sanction } from "@repo/types/prod/unions/sanction";
|
||||
MultiLineComponent,
|
||||
SuccessComponent,
|
||||
],
|
||||
selector: "appeal-form",
|
||||
styleUrl: "./appeal.component.css",
|
||||
selector: 'appeal-form',
|
||||
styleUrl: './appeal.component.css',
|
||||
templateUrl: "./appeal.component.html",
|
||||
})
|
||||
export class AppealComponent {
|
||||
@ -63,40 +58,45 @@ export class AppealComponent {
|
||||
|
||||
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 = "";
|
||||
const { form } = event.target as HTMLButtonElement;
|
||||
const { form } = e.target as HTMLButtonElement;
|
||||
const valid = form?.reportValidity();
|
||||
if (valid !== true) {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
this.loading = true;
|
||||
|
||||
this.apiService.
|
||||
submitAppeal({
|
||||
appealReason: this.appealReason.value ?? undefined,
|
||||
behaviourImprove: this.behaviourImprove.value ?? undefined,
|
||||
behaviourViolation: this.behaviourViolation.value ?? undefined,
|
||||
caseNumber: Number.parseInt(this.caseNumber.value ?? "0", 10),
|
||||
consent: this.consent.value ?? false,
|
||||
email: this.email.value ?? undefined,
|
||||
appealReason: this.appealReason.value ?? undefined,
|
||||
firstName: this.firstName.value ?? undefined,
|
||||
lastName: this.lastName.value ?? undefined,
|
||||
platformUsername: this.platformUsername.value ?? undefined,
|
||||
sanctionFair: this.sanctionFair.value ?? undefined,
|
||||
behaviourImprove: this.behaviourImprove.value ?? undefined,
|
||||
lastName: this.lastName.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,
|
||||
sanctionReason: this.sanctionReason.value ?? undefined,
|
||||
sanctionType:
|
||||
(this.sanctionType.value?.split(/\s+/)[0] as Sanction | undefined)
|
||||
?? undefined,
|
||||
sanctionReason: this.sanctionReason.value ?? undefined,
|
||||
understandBinding: this.understandBinding.value ?? undefined,
|
||||
}).
|
||||
then((response) => {
|
||||
if ("error" in response) {
|
||||
this.error = response.error;
|
||||
then((res) => {
|
||||
if ("error" in res) {
|
||||
this.error = res.error;
|
||||
this.loading = false;
|
||||
} else {
|
||||
this.error = "";
|
||||
|
@ -4,7 +4,7 @@
|
||||
<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="Explain your business needs and how we can meet those needs for you. Be as descriptive as possible.:" [control]="request"></app-multi-line>
|
||||
<app-multi-line label="Explain your business needs and how we can meet those needs for you. Be as descriptive as possible." [control]="request"></app-multi-line>
|
||||
<app-consent [control]="consent"></app-consent>
|
||||
<button type="button" (click)="submit($event)">Submit</button>
|
||||
</form>
|
||||
|
22
client/src/app/forms/commission/commission.component.spec.ts
Normal file
22
client/src/app/forms/commission/commission.component.spec.ts
Normal 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();
|
||||
});
|
||||
});
|
@ -1,20 +1,17 @@
|
||||
/**
|
||||
* @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";
|
||||
import { ConsentComponent } from "../../consent/consent.component";
|
||||
import { ErrorComponent } from "../../error/error.component";
|
||||
import { MultiLineComponent }
|
||||
from "../../inputs/multi-line/multi-line.component";
|
||||
import { SuccessComponent } from "../../success/success.component";
|
||||
import { UserinfoComponent } from "../../userinfo/userinfo.component";
|
||||
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";
|
||||
import type { ApiService } from "../../api.service.js";
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Component({
|
||||
imports: [
|
||||
RouterModule,
|
||||
@ -26,8 +23,8 @@ import { UserinfoComponent } from "../../userinfo/userinfo.component";
|
||||
MultiLineComponent,
|
||||
SuccessComponent,
|
||||
],
|
||||
selector: "commission-form",
|
||||
styleUrl: "./commission.component.css",
|
||||
selector: 'commission-form',
|
||||
styleUrl: './commission.component.css',
|
||||
templateUrl: "./commission.component.html",
|
||||
})
|
||||
export class CommissionComponent {
|
||||
@ -44,13 +41,19 @@ export class CommissionComponent {
|
||||
|
||||
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 = "";
|
||||
const { form } = event.target as HTMLButtonElement;
|
||||
const { form } = e.target as HTMLButtonElement;
|
||||
const valid = form?.reportValidity();
|
||||
if (valid !== true) {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
this.loading = true;
|
||||
@ -64,9 +67,9 @@ export class CommissionComponent {
|
||||
lastName: this.lastName.value ?? undefined,
|
||||
request: this.request.value ?? undefined,
|
||||
}).
|
||||
then((response) => {
|
||||
if ("error" in response) {
|
||||
this.error = response.error;
|
||||
then((res) => {
|
||||
if ("error" in res) {
|
||||
this.error = res.error;
|
||||
this.loading = false;
|
||||
} else {
|
||||
this.error = "";
|
||||
|
@ -5,7 +5,7 @@
|
||||
<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="What can we help you with today?:" [control]="request"></app-multi-line>
|
||||
<app-multi-line label="What can we help you with today?" [control]="request"></app-multi-line>
|
||||
<app-consent [control]="consent"></app-consent>
|
||||
<button type="button" (click)="submit($event)">Submit</button>
|
||||
</form>
|
||||
|
22
client/src/app/forms/contact/contact.component.spec.ts
Normal file
22
client/src/app/forms/contact/contact.component.spec.ts
Normal 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();
|
||||
});
|
||||
});
|
@ -1,20 +1,17 @@
|
||||
/**
|
||||
* @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";
|
||||
import { ConsentComponent } from "../../consent/consent.component";
|
||||
import { ErrorComponent } from "../../error/error.component";
|
||||
import { MultiLineComponent }
|
||||
from "../../inputs/multi-line/multi-line.component";
|
||||
import { SuccessComponent } from "../../success/success.component";
|
||||
import { UserinfoComponent } from "../../userinfo/userinfo.component";
|
||||
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";
|
||||
import type { ApiService } from "../../api.service.js";
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Component({
|
||||
imports: [
|
||||
RouterModule,
|
||||
@ -26,8 +23,8 @@ import { UserinfoComponent } from "../../userinfo/userinfo.component";
|
||||
MultiLineComponent,
|
||||
SuccessComponent,
|
||||
],
|
||||
selector: "contact-form",
|
||||
styleUrl: "./contact.component.css",
|
||||
selector: 'contact-form',
|
||||
styleUrl: './contact.component.css',
|
||||
templateUrl: "./contact.component.html",
|
||||
})
|
||||
export class ContactComponent {
|
||||
@ -44,13 +41,19 @@ export class ContactComponent {
|
||||
|
||||
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 = "";
|
||||
const { form } = event.target as HTMLButtonElement;
|
||||
const { form } = e.target as HTMLButtonElement;
|
||||
const valid = form?.reportValidity();
|
||||
if (valid !== true) {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
this.loading = true;
|
||||
@ -64,9 +67,9 @@ export class ContactComponent {
|
||||
lastName: this.lastName.value ?? undefined,
|
||||
request: this.request.value ?? undefined,
|
||||
}).
|
||||
then((response) => {
|
||||
if ("error" in response) {
|
||||
this.error = response.error;
|
||||
then((res) => {
|
||||
if ("error" in res) {
|
||||
this.error = res.error;
|
||||
this.loading = false;
|
||||
} else {
|
||||
this.error = "";
|
||||
|
@ -4,11 +4,11 @@
|
||||
<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="What is your event about?:" [control]="eventDescription"></app-multi-line>
|
||||
<app-multi-line label="What would you like us to speak about at your event?:" [control]="eventTopic"></app-multi-line>
|
||||
<app-single-line label="Where is your event located? Provide an address if in-person, a URL if remote.:" type="text" [control]="eventLocation"></app-single-line>
|
||||
<app-single-line label="When is your event?:" type="text" [control]="eventDate"></app-single-line>
|
||||
<app-single-line label="What is your budget to pay us for attending?:" type="text" [control]="eventBudget"></app-single-line>
|
||||
<app-multi-line label="What is your event about?" [control]="eventDescription"></app-multi-line>
|
||||
<app-multi-line label="What would you like us to speak about at your event?" [control]="eventTopic"></app-multi-line>
|
||||
<app-single-line label="Where is your event located? Provide an address if in-person, a URL if remote." type="text" [control]="eventLocation"></app-single-line>
|
||||
<app-single-line label="When is your event?" type="text" [control]="eventDate"></app-single-line>
|
||||
<app-single-line label="What is your budget to pay us for attending?" type="text" [control]="eventBudget"></app-single-line>
|
||||
<app-checkbox [control]="travelCovered" label="We will cover travel expenses for NHCarrigan to attend."></app-checkbox>
|
||||
<app-checkbox [control]="lodgingCovered" label="We will cover lodging expenses for NHCarrigan to attend."></app-checkbox>
|
||||
<app-checkbox [control]="foodCovered" label="We will cover food expenses for NHCarrigan to attend."></app-checkbox>
|
||||
|
22
client/src/app/forms/event/event.component.spec.ts
Normal file
22
client/src/app/forms/event/event.component.spec.ts
Normal 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();
|
||||
});
|
||||
});
|
@ -1,23 +1,19 @@
|
||||
/**
|
||||
* @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";
|
||||
import { ConsentComponent } from "../../consent/consent.component";
|
||||
import { ErrorComponent } from "../../error/error.component";
|
||||
import { CheckboxComponent } from "../../inputs/checkbox/checkbox.component";
|
||||
import { MultiLineComponent }
|
||||
from "../../inputs/multi-line/multi-line.component";
|
||||
import { SingleLineComponent }
|
||||
from "../../inputs/single-line/single-line.component";
|
||||
import { SuccessComponent } from "../../success/success.component";
|
||||
import { UserinfoComponent } from "../../userinfo/userinfo.component";
|
||||
import { ConsentComponent } from "../../consent/consent.component.js";
|
||||
import { ErrorComponent } from "../../error/error.component.js";
|
||||
import { CheckboxComponent } from "../../inputs/checkbox/checkbox.component.js";
|
||||
import { MultiLineComponent } from "../../inputs/multi-line/multi-line.component.js";
|
||||
import { SingleLineComponent } from "../../inputs/single-line/single-line.component.js";
|
||||
import { SuccessComponent } from "../../success/success.component.js";
|
||||
import { UserinfoComponent } from "../../userinfo/userinfo.component.js";
|
||||
import type { ApiService } from "../../api.service.js";
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Component({
|
||||
imports: [
|
||||
RouterModule,
|
||||
@ -31,8 +27,8 @@ import { UserinfoComponent } from "../../userinfo/userinfo.component";
|
||||
MultiLineComponent,
|
||||
SuccessComponent,
|
||||
],
|
||||
selector: "event-form",
|
||||
styleUrl: "./event.component.css",
|
||||
selector: 'event-form',
|
||||
styleUrl: './event.component.css',
|
||||
templateUrl: "./event.component.html",
|
||||
})
|
||||
export class EventComponent {
|
||||
@ -56,14 +52,19 @@ export class EventComponent {
|
||||
|
||||
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 = "";
|
||||
const { form } = event.target as HTMLButtonElement;
|
||||
const { form } = e.target as HTMLButtonElement;
|
||||
const valid = form?.reportValidity();
|
||||
if (valid !== true) {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
this.loading = true;
|
||||
@ -71,8 +72,8 @@ export class EventComponent {
|
||||
this.apiService.
|
||||
submitEvent({
|
||||
companyName: this.company.value ?? undefined,
|
||||
consent: this.consent.value ?? false,
|
||||
email: this.email.value ?? undefined,
|
||||
consent: this.consent.value ?? false,
|
||||
eventBudget: this.eventBudget.value ?? undefined,
|
||||
eventDate: this.eventDate.value ?? undefined,
|
||||
eventDescription: this.eventDescription.value ?? undefined,
|
||||
@ -84,9 +85,9 @@ export class EventComponent {
|
||||
lodgingCovered: this.lodgingCovered.value ?? false,
|
||||
travelCovered: this.travelCovered.value ?? false,
|
||||
}).
|
||||
then((response) => {
|
||||
if ("error" in response) {
|
||||
this.error = response.error;
|
||||
then((res) => {
|
||||
if ("error" in res) {
|
||||
this.error = res.error;
|
||||
this.loading = false;
|
||||
} else {
|
||||
this.error = "";
|
||||
|
@ -5,8 +5,8 @@
|
||||
<app-success *ngIf="success"></app-success>
|
||||
<form *ngIf="!loading">
|
||||
<app-userinfo [firstNameControl]="firstName" [lastNameControl]="lastName" [emailControl]="email" [companyControl]="company"></app-userinfo>
|
||||
<app-select-menu [control]="sessionLength" label="How long of a session would you like (in minutes)?:" options="15,30,60"></app-select-menu>
|
||||
<app-multi-line label="What do you wish to achieve during this session?:" [control]="sessionGoal"></app-multi-line>
|
||||
<app-select-menu [control]="sessionLength" label="How long of a session would you like (in minutes)?" options="15,30,60"></app-select-menu>
|
||||
<app-multi-line label="What do you wish to achieve during this session?" [control]="sessionGoal"></app-multi-line>
|
||||
<app-checkbox [control]="paymentUnderstanding" label="I understand that I will be invoiced for the session, and that payment must be submitted prior to the scheduled time or our session will be cancelled."></app-checkbox>
|
||||
<app-consent [control]="consent"></app-consent>
|
||||
<button type="button" (click)="submit($event)">Submit</button>
|
||||
|
22
client/src/app/forms/meeting/meeting.component.spec.ts
Normal file
22
client/src/app/forms/meeting/meeting.component.spec.ts
Normal 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();
|
||||
});
|
||||
});
|
@ -1,24 +1,20 @@
|
||||
/**
|
||||
* @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";
|
||||
import { ConsentComponent } from "../../consent/consent.component";
|
||||
import { ErrorComponent } from "../../error/error.component";
|
||||
import { CheckboxComponent } from "../../inputs/checkbox/checkbox.component";
|
||||
import { MultiLineComponent }
|
||||
from "../../inputs/multi-line/multi-line.component";
|
||||
import { SelectMenuComponent }
|
||||
from "../../inputs/select-menu/select-menu.component";
|
||||
import { SuccessComponent } from "../../success/success.component";
|
||||
import { UserinfoComponent } from "../../userinfo/userinfo.component";
|
||||
import type { SessionLength } from "@repo/types/prod/unions/session";
|
||||
import { ConsentComponent } from "../../consent/consent.component.js";
|
||||
import { ErrorComponent } from "../../error/error.component.js";
|
||||
import { CheckboxComponent } from "../../inputs/checkbox/checkbox.component.js";
|
||||
import { MultiLineComponent } from "../../inputs/multi-line/multi-line.component.js";
|
||||
import { SelectMenuComponent } from "../../inputs/select-menu/select-menu.component.js";
|
||||
import { SuccessComponent } from "../../success/success.component.js";
|
||||
import { UserinfoComponent } from "../../userinfo/userinfo.component.js";
|
||||
import type { ApiService } from "../../api.service.js";
|
||||
import type { SessionLength } from "@repo/types/prod/unions/session.js";
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Component({
|
||||
imports: [
|
||||
RouterModule,
|
||||
@ -32,8 +28,8 @@ import type { SessionLength } from "@repo/types/prod/unions/session";
|
||||
MultiLineComponent,
|
||||
SuccessComponent,
|
||||
],
|
||||
selector: "meeting-form",
|
||||
styleUrl: "./meeting.component.css",
|
||||
selector: 'meeting-form',
|
||||
styleUrl: './meeting.component.css',
|
||||
templateUrl: "./meeting.component.html",
|
||||
})
|
||||
export class MeetingComponent {
|
||||
@ -52,14 +48,19 @@ export class MeetingComponent {
|
||||
|
||||
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 = "";
|
||||
const { form } = event.target as HTMLButtonElement;
|
||||
const { form } = e.target as HTMLButtonElement;
|
||||
const valid = form?.reportValidity();
|
||||
if (valid !== true) {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
this.loading = true;
|
||||
@ -73,13 +74,11 @@ export class MeetingComponent {
|
||||
lastName: this.lastName.value ?? undefined,
|
||||
paymentUnderstanding: this.paymentUnderstanding.value ?? undefined,
|
||||
sessionGoal: this.sessionGoal.value ?? undefined,
|
||||
sessionLength: Number.parseInt(
|
||||
this.sessionLength.value ?? "15", 10,
|
||||
) as SessionLength,
|
||||
sessionLength: Number.parseInt(this.sessionLength.value ?? "15", 10) as SessionLength,
|
||||
}).
|
||||
then((response) => {
|
||||
if ("error" in response) {
|
||||
this.error = response.error;
|
||||
then((res) => {
|
||||
if ("error" in res) {
|
||||
this.error = res.error;
|
||||
this.loading = false;
|
||||
} else {
|
||||
this.error = "";
|
||||
|
@ -4,8 +4,8 @@
|
||||
<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="What do you want to focus on during your time in our programme?:" [control]="mentorshipGoal"></app-multi-line>
|
||||
<app-multi-line label="Where are you currently at in your learning journey?:" [control]="currentFocus"></app-multi-line>
|
||||
<app-multi-line label="What do you want to focus on during your time in our programme?" [control]="mentorshipGoal"></app-multi-line>
|
||||
<app-multi-line label="Where are you currently at in your learning journey?" [control]="currentFocus"></app-multi-line>
|
||||
<app-checkbox [control]="paymentUnderstanding" label="I understand that the programme cost is $200 per month, due on the first of the month. I also understand that failure to pay on the due date will result in my removal from the programme."></app-checkbox>
|
||||
<app-consent [control]="consent"></app-consent>
|
||||
<button type="button" (click)="submit($event)">Submit</button>
|
||||
|
22
client/src/app/forms/mentorship/mentorship.component.spec.ts
Normal file
22
client/src/app/forms/mentorship/mentorship.component.spec.ts
Normal 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();
|
||||
});
|
||||
});
|
@ -1,21 +1,18 @@
|
||||
/**
|
||||
* @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";
|
||||
import { ConsentComponent } from "../../consent/consent.component";
|
||||
import { ErrorComponent } from "../../error/error.component";
|
||||
import { CheckboxComponent } from "../../inputs/checkbox/checkbox.component";
|
||||
import { MultiLineComponent }
|
||||
from "../../inputs/multi-line/multi-line.component";
|
||||
import { SuccessComponent } from "../../success/success.component";
|
||||
import { UserinfoComponent } from "../../userinfo/userinfo.component";
|
||||
import { ConsentComponent } from "../../consent/consent.component.js";
|
||||
import { ErrorComponent } from "../../error/error.component.js";
|
||||
import { CheckboxComponent } from "../../inputs/checkbox/checkbox.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";
|
||||
import type { ApiService } from "../../api.service.js";
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Component({
|
||||
imports: [
|
||||
RouterModule,
|
||||
@ -28,8 +25,8 @@ import { UserinfoComponent } from "../../userinfo/userinfo.component";
|
||||
MultiLineComponent,
|
||||
SuccessComponent,
|
||||
],
|
||||
selector: "mentorship-form",
|
||||
styleUrl: "./mentorship.component.css",
|
||||
selector: 'mentorship-form',
|
||||
styleUrl: './mentorship.component.css',
|
||||
templateUrl: "./mentorship.component.html",
|
||||
})
|
||||
export class MentorshipComponent {
|
||||
@ -48,14 +45,19 @@ export class MentorshipComponent {
|
||||
|
||||
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 = "";
|
||||
const { form } = event.target as HTMLButtonElement;
|
||||
const { form } = e.target as HTMLButtonElement;
|
||||
const valid = form?.reportValidity();
|
||||
if (valid !== true) {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
this.loading = true;
|
||||
@ -71,9 +73,9 @@ export class MentorshipComponent {
|
||||
mentorshipGoal: this.mentorshipGoal.value ?? undefined,
|
||||
paymentUnderstanding: this.paymentUnderstanding.value ?? false,
|
||||
}).
|
||||
then((response) => {
|
||||
if ("error" in response) {
|
||||
this.error = response.error;
|
||||
then((res) => {
|
||||
if ("error" in res) {
|
||||
this.error = res.error;
|
||||
this.loading = false;
|
||||
} else {
|
||||
this.error = "";
|
||||
|
@ -7,16 +7,16 @@
|
||||
<app-userinfo [firstNameControl]="firstName" [lastNameControl]="lastName" [emailControl]="email" [companyControl]="company"></app-userinfo>
|
||||
<app-checkbox [control]="understandVolunteer" label="I understand that my membership on the staff team is on a voluntary basis, and I expect no compensation for my time or effort."></app-checkbox>
|
||||
<div class="two-col">
|
||||
<app-select-menu [control]="platform" label="Which platform do you wish to moderate?:" options="Forum,IRC,Matrix,Gitea,Fediverse"></app-select-menu>
|
||||
<app-single-line label="What is your username on that platform?:" type="text" [control]="platformUsername"></app-single-line>
|
||||
<app-select-menu [control]="platform" label="Which platform do you wish to moderate?" options="Forum,IRC,Matrix,Gitea,Fediverse"></app-select-menu>
|
||||
<app-single-line label="What is your username on that platform?" type="text" [control]="platformUsername"></app-single-line>
|
||||
</div>
|
||||
<app-multi-line label="Why do you wish to join our team?:" [control]="whyJoin"></app-multi-line>
|
||||
<app-multi-line label="Describe how your current behaviour in our communities embodies our Code of Conduct, Community Guidelines, and other Policies.:" [control]="currentBehaviour"></app-multi-line>
|
||||
<app-multi-line label="What prior moderation experience do you have, if any?:" [control]="priorExperience"></app-multi-line>
|
||||
<app-multi-line label="You and another member of our team are in disagreement with how to handle a situation, and are unable to reach a consensus. What do you do?:" [control]="internalConflict"></app-multi-line>
|
||||
<app-multi-line label="A member of the community has posted material which violates our rules and may be traumatic to other members. How do you address the situation to ensure the well-being of our community?:" [control]="handlingTrauma"></app-multi-line>
|
||||
<app-multi-line label="Explain a time where you were in a difficult situation, and you had to be the one to resolve it. How did you do so, and why did you take that approach?:" [control]="difficultSituation"></app-multi-line>
|
||||
<app-multi-line label="Explain a situation in which you had to display strong leadership. How did you do so, and why did you take that approach?:" [control]="leadershipSituation"></app-multi-line>
|
||||
<app-multi-line label="Why do you wish to join our team?" [control]="whyJoin"></app-multi-line>
|
||||
<app-multi-line label="Describe how your current behaviour in our communities embodies our Code of Conduct, Community Guidelines, and other Policies." [control]="currentBehaviour"></app-multi-line>
|
||||
<app-multi-line label="What prior moderation experience do you have, if any?" [control]="priorExperience"></app-multi-line>
|
||||
<app-multi-line label="You and another member of our team are in disagreement with how to handle a situation, and are unable to reach a consensus. What do you do?" [control]="internalConflict"></app-multi-line>
|
||||
<app-multi-line label="A member of the community has posted material which violates our rules and may be traumatic to other members. How do you address the situation to ensure the well-being of our community?" [control]="handlingTrauma"></app-multi-line>
|
||||
<app-multi-line label="Explain a time where you were in a difficult situation, and you had to be the one to resolve it. How did you do so, and why did you take that approach?" [control]="difficultSituation"></app-multi-line>
|
||||
<app-multi-line label="Explain a situation in which you had to display strong leadership. How did you do so, and why did you take that approach?" [control]="leadershipSituation"></app-multi-line>
|
||||
<app-consent [control]="consent"></app-consent>
|
||||
<button type="button" (click)="submit($event)">Submit</button>
|
||||
</form>
|
||||
|
22
client/src/app/forms/staff/staff.component.spec.ts
Normal file
22
client/src/app/forms/staff/staff.component.spec.ts
Normal 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();
|
||||
});
|
||||
});
|
@ -1,26 +1,21 @@
|
||||
/**
|
||||
* @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";
|
||||
import { ConsentComponent } from "../../consent/consent.component";
|
||||
import { ErrorComponent } from "../../error/error.component";
|
||||
import { CheckboxComponent } from "../../inputs/checkbox/checkbox.component";
|
||||
import { MultiLineComponent }
|
||||
from "../../inputs/multi-line/multi-line.component";
|
||||
import { SelectMenuComponent }
|
||||
from "../../inputs/select-menu/select-menu.component";
|
||||
import { SingleLineComponent }
|
||||
from "../../inputs/single-line/single-line.component";
|
||||
import { SuccessComponent } from "../../success/success.component";
|
||||
import { UserinfoComponent } from "../../userinfo/userinfo.component";
|
||||
import type { Platform } from "@repo/types/prod/unions/platform";
|
||||
import type { Platform } from "@repo/types/prod/unions/platform.js";
|
||||
import type { ApiService } from "../../api.service.js";
|
||||
import { ConsentComponent } from "../../consent/consent.component.js";
|
||||
import { ErrorComponent } from "../../error/error.component.js";
|
||||
import { CheckboxComponent } from "../../inputs/checkbox/checkbox.component.js";
|
||||
import { MultiLineComponent } from "../../inputs/multi-line/multi-line.component.js";
|
||||
import { SelectMenuComponent } from "../../inputs/select-menu/select-menu.component.js";
|
||||
import { SingleLineComponent } from "../../inputs/single-line/single-line.component.js";
|
||||
import { SuccessComponent } from "../../success/success.component.js";
|
||||
import { UserinfoComponent } from "../../userinfo/userinfo.component.js";
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Component({
|
||||
imports: [
|
||||
RouterModule,
|
||||
@ -35,8 +30,8 @@ import type { Platform } from "@repo/types/prod/unions/platform";
|
||||
MultiLineComponent,
|
||||
SuccessComponent,
|
||||
],
|
||||
selector: "staff-form",
|
||||
styleUrl: "./staff.component.css",
|
||||
selector: 'staff-form',
|
||||
styleUrl: './staff.component.css',
|
||||
templateUrl: "./staff.component.html",
|
||||
})
|
||||
export class StaffComponent {
|
||||
@ -62,27 +57,32 @@ export class StaffComponent {
|
||||
|
||||
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 = "";
|
||||
const { form } = event.target as HTMLButtonElement;
|
||||
const { form } = e.target as HTMLButtonElement;
|
||||
const valid = form?.reportValidity();
|
||||
if (valid !== true) {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
this.loading = true;
|
||||
|
||||
this.apiService.
|
||||
submitStaff({
|
||||
consent: this.consent.value ?? false,
|
||||
currentBehaviour: this.currentBehaviour.value ?? undefined,
|
||||
difficultSituation: this.difficultSituation.value ?? undefined,
|
||||
email: this.email.value ?? undefined,
|
||||
difficultSituation: this.difficultSituation.value ?? undefined,
|
||||
firstName: this.firstName.value ?? undefined,
|
||||
handlingTrauma: this.handlingTrauma.value ?? undefined,
|
||||
consent: this.consent.value ?? false,
|
||||
internalConflict: this.internalConflict.value ?? undefined,
|
||||
handlingTrauma: this.handlingTrauma.value ?? undefined,
|
||||
lastName: this.lastName.value ?? undefined,
|
||||
leadershipSituation: this.leadershipSituation.value ?? undefined,
|
||||
platform: this.platform.value ?? undefined,
|
||||
@ -91,9 +91,9 @@ export class StaffComponent {
|
||||
understandVolunteer: this.understandVolunteer.value ?? false,
|
||||
whyJoin: this.whyJoin.value ?? undefined,
|
||||
}).
|
||||
then((response) => {
|
||||
if ("error" in response) {
|
||||
this.error = response.error;
|
||||
then((res) => {
|
||||
if ("error" in res) {
|
||||
this.error = res.error;
|
||||
this.loading = false;
|
||||
} else {
|
||||
this.error = "";
|
||||
|
@ -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">
|
||||
<i class="fa-solid fa-brain" aria-hidden="true"></i> Mentorship Programme
|
||||
</a>
|
||||
<a routerLink="/testimonial">
|
||||
<i class="fa-solid fa-star-half-stroke" aria-hidden="true"></i> Testimonials
|
||||
</a>
|
||||
|
22
client/src/app/home/home.component.spec.ts
Normal file
22
client/src/app/home/home.component.spec.ts
Normal 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();
|
||||
});
|
||||
});
|
@ -1,15 +1,13 @@
|
||||
/**
|
||||
* @copyright nhcarrigan
|
||||
* @license Naomi's Public License
|
||||
* @author Naomi Carrigan
|
||||
*/
|
||||
import { Component } from "@angular/core";
|
||||
import { RouterModule } from "@angular/router";
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Component({
|
||||
imports: [ RouterModule ],
|
||||
selector: "app-home",
|
||||
styleUrl: "./home.component.css",
|
||||
selector: 'app-home',
|
||||
styleUrl: './home.component.css',
|
||||
templateUrl: "./home.component.html",
|
||||
})
|
||||
export class HomeComponent {
|
||||
|
22
client/src/app/inputs/checkbox/checkbox.component.spec.ts
Normal file
22
client/src/app/inputs/checkbox/checkbox.component.spec.ts
Normal 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();
|
||||
});
|
||||
});
|
@ -1,15 +1,13 @@
|
||||
/**
|
||||
* @copyright nhcarrigan
|
||||
* @license Naomi's Public License
|
||||
* @author Naomi Carrigan
|
||||
*/
|
||||
import { Component, input } from "@angular/core";
|
||||
import { ReactiveFormsModule, type FormControl } from "@angular/forms";
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Component({
|
||||
imports: [ ReactiveFormsModule ],
|
||||
selector: "app-checkbox",
|
||||
styleUrl: "./checkbox.component.css",
|
||||
selector: 'app-checkbox',
|
||||
styleUrl: './checkbox.component.css',
|
||||
templateUrl: "./checkbox.component.html",
|
||||
})
|
||||
export class CheckboxComponent {
|
||||
|
@ -1,4 +1,4 @@
|
||||
<div>
|
||||
<label for="{{label()}}-input">{{ label() }}</label>
|
||||
<label for="{{label()}}-input">{{ label() }}:</label>
|
||||
<textarea id="{{label()}}-input" required [formControl]="control()"></textarea>
|
||||
</div>
|
||||
|
@ -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();
|
||||
});
|
||||
});
|
@ -1,16 +1,14 @@
|
||||
/**
|
||||
* @copyright nhcarrigan
|
||||
* @license Naomi's Public License
|
||||
* @author Naomi Carrigan
|
||||
*/
|
||||
import { CommonModule } from "@angular/common";
|
||||
import { Component, input } from "@angular/core";
|
||||
import { ReactiveFormsModule, type FormControl } from "@angular/forms";
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Component({
|
||||
imports: [ CommonModule, ReactiveFormsModule ],
|
||||
selector: "app-multi-line",
|
||||
styleUrl: "./multi-line.component.css",
|
||||
selector: 'app-multi-line',
|
||||
styleUrl: './multi-line.component.css',
|
||||
templateUrl: "./multi-line.component.html",
|
||||
})
|
||||
export class MultiLineComponent {
|
||||
|
@ -1,5 +1,5 @@
|
||||
<div>
|
||||
<label for="{{label()}}-input">{{ label() }}</label>
|
||||
<label for="{{label()}}-input">{{ label() }}:</label>
|
||||
<select id="{{label()}}-input" [formControl]="control()" required>
|
||||
<option value="" disabled selected>Select an option</option>
|
||||
<option *ngFor="let option of options().split(',')" [value]="option">{{ option }}</option>
|
||||
|
@ -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();
|
||||
});
|
||||
});
|
@ -1,16 +1,14 @@
|
||||
/**
|
||||
* @copyright nhcarrigan
|
||||
* @license Naomi's Public License
|
||||
* @author Naomi Carrigan
|
||||
*/
|
||||
import { CommonModule } from "@angular/common";
|
||||
import { Component, input } from "@angular/core";
|
||||
import { ReactiveFormsModule, type FormControl } from "@angular/forms";
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Component({
|
||||
imports: [ CommonModule, ReactiveFormsModule ],
|
||||
selector: "app-select-menu",
|
||||
styleUrl: "./select-menu.component.css",
|
||||
selector: 'app-select-menu',
|
||||
styleUrl: './select-menu.component.css',
|
||||
templateUrl: "./select-menu.component.html",
|
||||
})
|
||||
export class SelectMenuComponent {
|
||||
|
@ -1,4 +1,4 @@
|
||||
<div>
|
||||
<label for="{{label()}}-input">{{ label() }}</label>
|
||||
<label for="{{label()}}-input">{{ label() }}:</label>
|
||||
<input [type]="type()" id="{{label()}}-input" required [formControl]="control()" />
|
||||
</div>
|
||||
|
@ -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();
|
||||
});
|
||||
});
|
@ -1,17 +1,14 @@
|
||||
/**
|
||||
* @copyright nhcarrigan
|
||||
* @license Naomi's Public License
|
||||
* @author Naomi Carrigan
|
||||
*/
|
||||
|
||||
import { CommonModule } from "@angular/common";
|
||||
import { Component, input } from "@angular/core";
|
||||
import { type FormControl, ReactiveFormsModule } from "@angular/forms";
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Component({
|
||||
imports: [ CommonModule, ReactiveFormsModule ],
|
||||
selector: "app-single-line",
|
||||
styleUrl: "./single-line.component.css",
|
||||
selector: 'app-single-line',
|
||||
styleUrl: './single-line.component.css',
|
||||
templateUrl: "./single-line.component.html",
|
||||
})
|
||||
export class SingleLineComponent {
|
||||
|
@ -2,7 +2,7 @@
|
||||
<app-error *ngIf="error" error="{{ error }}"></app-error>
|
||||
<form *ngIf="!valid">
|
||||
<app-single-line
|
||||
label="API Key:"
|
||||
label="API Key"
|
||||
[control]="token"
|
||||
type="text"
|
||||
></app-single-line>
|
||||
@ -58,21 +58,11 @@
|
||||
>
|
||||
Staff Applications
|
||||
</button>
|
||||
<button
|
||||
[disabled]="view === 'testimonials'"
|
||||
type="button"
|
||||
(click)="setView('testimonials')"
|
||||
>
|
||||
Testimonials
|
||||
</button>
|
||||
<h2>{{ view }}</h2>
|
||||
<div *ngFor="let datum of data">
|
||||
<h3>{{ datum.email }}</h3>
|
||||
<div *ngFor="let obj of datum.info">
|
||||
<p>
|
||||
<strong>{{ obj.key }}</strong
|
||||
>: {{ obj.value }}
|
||||
</p>
|
||||
<p><strong>{{ obj.key }}</strong>: {{ obj.value }}</p>
|
||||
</div>
|
||||
<button type="button" (click)="markReviewed(datum.id)">
|
||||
Mark as Reviewed
|
||||
|
22
client/src/app/review/review.component.spec.ts
Normal file
22
client/src/app/review/review.component.spec.ts
Normal 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();
|
||||
});
|
||||
});
|
@ -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 { Component } from "@angular/core";
|
||||
import { FormControl, ReactiveFormsModule } from "@angular/forms";
|
||||
import { RouterModule } from "@angular/router";
|
||||
import { ApiService } from "../api.service";
|
||||
import { ErrorComponent } from "../error/error.component";
|
||||
import { SingleLineComponent }
|
||||
from "../inputs/single-line/single-line.component";
|
||||
import { ErrorComponent } from "../error/error.component.js";
|
||||
import { SingleLineComponent } from "../inputs/single-line/single-line.component.js";
|
||||
import type { ApiService } from "../api.service.js";
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Component({
|
||||
imports: [
|
||||
CommonModule,
|
||||
@ -21,17 +17,15 @@ import { SingleLineComponent }
|
||||
SingleLineComponent,
|
||||
ErrorComponent,
|
||||
],
|
||||
selector: "app-review",
|
||||
styleUrl: "./review.component.css",
|
||||
selector: 'app-review',
|
||||
styleUrl: './review.component.css',
|
||||
templateUrl: "./review.component.html",
|
||||
})
|
||||
export class ReviewComponent {
|
||||
public error = "";
|
||||
public token = new FormControl("");
|
||||
public valid = false;
|
||||
public data: Array<{
|
||||
email: string; id: string; info: Array<{ key: string; value: unknown }>;
|
||||
}> = [];
|
||||
public data: Array<{ email: string; id: string; info: Array<{ key: string; value: unknown }> }> = [];
|
||||
|
||||
public view:
|
||||
| ""
|
||||
@ -41,43 +35,52 @@ export class ReviewComponent {
|
||||
| "events"
|
||||
| "meetings"
|
||||
| "mentorships"
|
||||
| "staff"
|
||||
| "testimonials" = "";
|
||||
| "staff" = "";
|
||||
|
||||
public constructor(private readonly apiService: ApiService) {
|
||||
/**
|
||||
* @param apiService
|
||||
*/
|
||||
constructor(private readonly apiService: ApiService) {
|
||||
const storedToken = localStorage.getItem("token");
|
||||
if (storedToken === null) {
|
||||
if (!storedToken) {
|
||||
return;
|
||||
}
|
||||
this.apiService.validateToken(storedToken).
|
||||
then((valid) => {
|
||||
if (valid) {
|
||||
this.valid = true;
|
||||
this.token.setValue(storedToken);
|
||||
} else {
|
||||
this.error = "The token found in local storage is invalid.";
|
||||
this.valid = false;
|
||||
}
|
||||
}).
|
||||
catch(() => {
|
||||
// eslint-disable-next-line stylistic/max-len -- Long string
|
||||
this.error = "An error occurred while validating the token found in local storage.";
|
||||
this.valid = false;
|
||||
});
|
||||
this.token.setValue(storedToken);
|
||||
this.valid = true;
|
||||
|
||||
/*
|
||||
* This.apiService
|
||||
* .validateToken(storedToken)
|
||||
* .then((valid) => {
|
||||
* if (valid) {
|
||||
* this.valid = true;
|
||||
* } else {
|
||||
* this.error = 'The token found in local storage is invalid.';
|
||||
* 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 = "";
|
||||
const { form } = event.target as HTMLButtonElement;
|
||||
const { form } = e.target as HTMLButtonElement;
|
||||
const valid = form?.reportValidity();
|
||||
if (valid !== true) {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.apiService.
|
||||
validateToken(this.token.value).
|
||||
then((tokenValid) => {
|
||||
if (tokenValid) {
|
||||
then((valid) => {
|
||||
if (valid) {
|
||||
this.valid = true;
|
||||
localStorage.setItem("token", this.token.value as string);
|
||||
} else {
|
||||
@ -91,29 +94,25 @@ export class ReviewComponent {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
*/
|
||||
public markReviewed(id: string): void {
|
||||
const view = this.view as
|
||||
| "appeals"
|
||||
| "commissions"
|
||||
| "contacts"
|
||||
| "events"
|
||||
| "meetings"
|
||||
| "mentorships"
|
||||
| "staff"
|
||||
| "testimonials";
|
||||
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;
|
||||
});
|
||||
}
|
||||
});
|
||||
const view = this.view as "appeals" | "commissions" | "contacts" | "events" | "meetings" | "mentorships" | "staff";
|
||||
this.apiService.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(
|
||||
view:
|
||||
| "appeals"
|
||||
@ -122,28 +121,20 @@ export class ReviewComponent {
|
||||
| "events"
|
||||
| "meetings"
|
||||
| "mentorships"
|
||||
| "staff"
|
||||
| "testimonials",
|
||||
| "staff",
|
||||
): void {
|
||||
this.view = view;
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- We know token is not null
|
||||
void this.apiService.getData(view, this.token.value!).then((data) => {
|
||||
this.apiService.getData(view, this.token.value!).then((data) => {
|
||||
if ("error" in data) {
|
||||
this.error = data.error;
|
||||
} else {
|
||||
this.data = (data.data as Array<
|
||||
{ email: string; id: string } & Record<string, unknown>
|
||||
>).map((item) => {
|
||||
const object:
|
||||
{
|
||||
email: string;
|
||||
id: string;
|
||||
info: Array<{ key: string; value: unknown }>;
|
||||
}
|
||||
= { email: item.email, id: item.id, info: [] };
|
||||
const object: { email: string; id: string; info: Array<{ key: string; value: unknown }> } = { email: item.email, id: item.id, info: [] };
|
||||
for (const key in item) {
|
||||
if (![ "email", "id" ].includes(key)) {
|
||||
object.info.push({ key: key, value: item[key] });
|
||||
object.info.push({ key, value: item[key] });
|
||||
}
|
||||
}
|
||||
return object;
|
||||
|
22
client/src/app/success/success.component.spec.ts
Normal file
22
client/src/app/success/success.component.spec.ts
Normal 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();
|
||||
});
|
||||
});
|
@ -1,15 +1,12 @@
|
||||
/**
|
||||
* @copyright nhcarrigan
|
||||
* @license Naomi's Public License
|
||||
* @author Naomi Carrigan
|
||||
*/
|
||||
|
||||
import { Component } from "@angular/core";
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Component({
|
||||
imports: [],
|
||||
selector: "app-success",
|
||||
styleUrl: "./success.component.css",
|
||||
selector: 'app-success',
|
||||
styleUrl: './success.component.css',
|
||||
templateUrl: "./success.component.html",
|
||||
})
|
||||
export class SuccessComponent {
|
||||
|
@ -1,8 +1,8 @@
|
||||
<div class="two-col">
|
||||
<app-single-line label="First Name:" type="text" [control]="firstNameControl()"></app-single-line>
|
||||
<app-single-line label="Last Name:" type="text" [control]="lastNameControl()"></app-single-line>
|
||||
<app-single-line label="First Name" type="text" [control]="firstNameControl()"></app-single-line>
|
||||
<app-single-line label="Last Name" type="text" [control]="lastNameControl()"></app-single-line>
|
||||
</div>
|
||||
<div class="two-col">
|
||||
<app-single-line label="Email:" type="email" [control]="emailControl()"></app-single-line>
|
||||
<app-single-line label="Company Name:" type="text" [control]="companyControl()"></app-single-line>
|
||||
<app-single-line label="Email" type="email" [control]="emailControl()"></app-single-line>
|
||||
<app-single-line label="Company Name" type="text" [control]="companyControl()"></app-single-line>
|
||||
</div>
|
22
client/src/app/userinfo/userinfo.component.spec.ts
Normal file
22
client/src/app/userinfo/userinfo.component.spec.ts
Normal 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();
|
||||
});
|
||||
});
|
@ -1,18 +1,14 @@
|
||||
/**
|
||||
* @copyright nhcarrigan
|
||||
* @license Naomi's Public License
|
||||
* @author Naomi Carrigan
|
||||
*/
|
||||
|
||||
import { Component, input } from "@angular/core";
|
||||
import { SingleLineComponent }
|
||||
from "../inputs/single-line/single-line.component";
|
||||
import { SingleLineComponent } from "../inputs/single-line/single-line.component.js";
|
||||
import type { FormControl } from "@angular/forms";
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Component({
|
||||
imports: [ SingleLineComponent ],
|
||||
selector: "app-userinfo",
|
||||
styleUrl: "./userinfo.component.css",
|
||||
selector: 'app-userinfo',
|
||||
styleUrl: './userinfo.component.css',
|
||||
templateUrl: "./userinfo.component.html",
|
||||
})
|
||||
export class UserinfoComponent {
|
||||
|
@ -1,15 +1,8 @@
|
||||
/**
|
||||
* @copyright nhcarrigan
|
||||
* @license Naomi's Public License
|
||||
* @author Naomi Carrigan
|
||||
*/
|
||||
|
||||
import { bootstrapApplication } from "@angular/platform-browser";
|
||||
import { AppComponent } from "./app/app.component";
|
||||
import { appConfig } from "./app/app.config";
|
||||
|
||||
bootstrapApplication(AppComponent, appConfig).
|
||||
// eslint-disable-next-line unicorn/prefer-top-level-await -- This is the entry point of the application.
|
||||
catch((error: unknown) => {
|
||||
catch((error) => {
|
||||
console.error(error);
|
||||
});
|
||||
|
15
client/tsconfig.app.json
Normal file
15
client/tsconfig.app.json
Normal 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"
|
||||
]
|
||||
}
|
@ -16,7 +16,7 @@
|
||||
"moduleResolution": "bundler",
|
||||
"importHelpers": true,
|
||||
"target": "ES2022",
|
||||
"module": "ES2022",
|
||||
"module": "ES2022"
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"enableI18nLegacyMessageIdFormat": false,
|
||||
|
15
client/tsconfig.spec.json
Normal file
15
client/tsconfig.spec.json
Normal 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"
|
||||
]
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "forms",
|
||||
"version": "1.0.0",
|
||||
"version": "0.0.0",
|
||||
"description": "Application for managing and submitting our various forms!",
|
||||
"main": "index.js",
|
||||
"packageManager": "pnpm@10.0.0",
|
||||
@ -8,7 +8,7 @@
|
||||
"build": "turbo build",
|
||||
"start": "turbo start",
|
||||
"lint": "turbo lint",
|
||||
"test": "turbo test"
|
||||
"test": "echo \"Error: no test specified\" && exit 0"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
|
@ -8,7 +8,7 @@
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"lint": "eslint src --max-warnings 0",
|
||||
"test": "echo \"Error: no test specified\" && exit 0"
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
|
@ -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 { Mentorship } from "./forms/mentorship.js";
|
||||
import type { Staff } from "./forms/staff.js";
|
||||
import type { Testimonial } from "./forms/testimonial.js";
|
||||
import type { ReviewRequest } from "./requests/review.js";
|
||||
import type { DataResponse } from "./responses/data.js";
|
||||
import type { ErrorResponse } from "./responses/error.js";
|
||||
@ -29,5 +28,4 @@ export type {
|
||||
DataResponse,
|
||||
ErrorResponse,
|
||||
SuccessResponse,
|
||||
Testimonial,
|
||||
};
|
||||
|
31
pnpm-lock.yaml
generated
31
pnpm-lock.yaml
generated
@ -73,9 +73,6 @@ importers:
|
||||
'@types/jasmine':
|
||||
specifier: ~5.1.0
|
||||
version: 5.1.6
|
||||
eslint:
|
||||
specifier: 9.20.1
|
||||
version: 9.20.1(jiti@1.21.7)
|
||||
jasmine-core:
|
||||
specifier: ~5.5.0
|
||||
version: 5.5.0
|
||||
@ -118,9 +115,6 @@ importers:
|
||||
|
||||
server:
|
||||
dependencies:
|
||||
'@fastify/cors':
|
||||
specifier: 10.0.2
|
||||
version: 10.0.2
|
||||
'@nhcarrigan/logger':
|
||||
specifier: 1.0.0
|
||||
version: 1.0.0
|
||||
@ -1071,9 +1065,6 @@ packages:
|
||||
'@fastify/ajv-compiler@4.0.2':
|
||||
resolution: {integrity: sha512-Rkiu/8wIjpsf46Rr+Fitd3HRP+VsxUFDDeag0hs9L0ksfnwx2g7SPQQTFL0E8Qv+rfXzQOxBJnjUB9ITUDjfWQ==}
|
||||
|
||||
'@fastify/cors@10.0.2':
|
||||
resolution: {integrity: sha512-DGdxOG36sS/tZv1NFiCJGi7wGuXOSPL2CmNX5PbOVKx0C6LuIALRMrqLByHTCcX1Rbl8NJ9IWlJex32bzydvlw==}
|
||||
|
||||
'@fastify/error@4.0.0':
|
||||
resolution: {integrity: sha512-OO/SA8As24JtT1usTUTKgGH7uLvhfwZPwlptRi2Dp5P4KKmJI3gvsZ8MIHnNwDs4sLf/aai5LzTyl66xr7qMxA==}
|
||||
|
||||
@ -3143,9 +3134,6 @@ packages:
|
||||
fast-uri@3.0.6:
|
||||
resolution: {integrity: sha512-Atfo14OibSv5wAp4VWNsFYE1AchQRTv9cBGWET4pZWHzYshFSS9NQI6I57rdKn9croWVMbYFbLhJ+yJvmZIIHw==}
|
||||
|
||||
fastify-plugin@5.0.1:
|
||||
resolution: {integrity: sha512-HCxs+YnRaWzCl+cWRYFnHmeRFyR5GVnJTAaCJQiYzQSDwK9MgJdyAsuL3nh0EWRCYMgQ5MeziymvmAhUHYHDUQ==}
|
||||
|
||||
fastify@5.2.1:
|
||||
resolution: {integrity: sha512-rslrNBF67eg8/Gyn7P2URV8/6pz8kSAscFL4EThZJ8JBMaXacVdVE4hmUcnPNKERl5o/xTiBSLfdowBRhVF1WA==}
|
||||
|
||||
@ -4109,9 +4097,6 @@ packages:
|
||||
engines: {node: '>=10'}
|
||||
hasBin: true
|
||||
|
||||
mnemonist@0.39.8:
|
||||
resolution: {integrity: sha512-vyWo2K3fjrUw8YeeZ1zF0fy6Mu59RHokURlld8ymdUPjMlD9EC9ov1/YPqTgqRvUN9nTr3Gqfz29LYAmu0PHPQ==}
|
||||
|
||||
mrmime@2.0.0:
|
||||
resolution: {integrity: sha512-eu38+hdgojoyq63s+yTpN4XMBdt5l8HhMhc4VKLO9KM5caLIBvUm4thi7fFaxyTmCKeNnXZ5pAlBwCUnhA09uw==}
|
||||
engines: {node: '>=10'}
|
||||
@ -4274,9 +4259,6 @@ packages:
|
||||
resolution: {integrity: sha512-gXah6aZrcUxjWg2zR2MwouP2eHlCBzdV4pygudehaKXSGW4v2AsRQUK+lwwXhii6KFZcunEnmSUoYp5CXibxtA==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
obliterator@2.0.5:
|
||||
resolution: {integrity: sha512-42CPE9AhahZRsMNslczq0ctAEtqk8Eka26QofnqC346BZdHDySk3LWka23LI7ULIw11NmltpiLagIq8gBozxTw==}
|
||||
|
||||
obuf@1.1.2:
|
||||
resolution: {integrity: sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==}
|
||||
|
||||
@ -6873,11 +6855,6 @@ snapshots:
|
||||
ajv-formats: 3.0.1(ajv@8.17.1)
|
||||
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/fast-json-stringify-compiler@5.0.2':
|
||||
@ -9172,8 +9149,6 @@ snapshots:
|
||||
|
||||
fast-uri@3.0.6: {}
|
||||
|
||||
fastify-plugin@5.0.1: {}
|
||||
|
||||
fastify@5.2.1:
|
||||
dependencies:
|
||||
'@fastify/ajv-compiler': 4.0.2
|
||||
@ -10216,10 +10191,6 @@ snapshots:
|
||||
|
||||
mkdirp@3.0.1: {}
|
||||
|
||||
mnemonist@0.39.8:
|
||||
dependencies:
|
||||
obliterator: 2.0.5
|
||||
|
||||
mrmime@2.0.0: {}
|
||||
|
||||
ms@2.0.0: {}
|
||||
@ -10403,8 +10374,6 @@ snapshots:
|
||||
define-properties: 1.2.1
|
||||
es-object-atoms: 1.1.1
|
||||
|
||||
obliterator@2.0.5: {}
|
||||
|
||||
obuf@1.1.2: {}
|
||||
|
||||
on-exit-leak-free@2.1.2: {}
|
||||
|
@ -103,12 +103,3 @@ model Mentorships {
|
||||
paymentUnderstanding Boolean
|
||||
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())
|
||||
}
|
||||
|
@ -24,7 +24,6 @@
|
||||
"typescript": "5.7.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fastify/cors": "10.0.2",
|
||||
"@nhcarrigan/logger": "1.0.0",
|
||||
"@prisma/client": "6.3.1",
|
||||
"fastify": "5.2.1",
|
||||
|
@ -29,8 +29,7 @@ export const listHandler = async(
|
||||
}),
|
||||
});
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- we bein' lazy.
|
||||
await logger.error(`/list/${route}`, error as Error);
|
||||
await logger.error(`/list/${route}`, error);
|
||||
await response.status(500).send({ error: error instanceof Error
|
||||
? error.message
|
||||
: "Internal Server Error" });
|
||||
|
@ -47,8 +47,7 @@ export const reviewHandler = async(
|
||||
await markSubmissionReviewed(database, route, submissionId);
|
||||
await response.code(200).send({ success: true });
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- we bein' lazy.
|
||||
await logger.error(`/review/${route}`, error as Error);
|
||||
await logger.error(`/review/${route}`, error);
|
||||
await response.status(500).send({ error: error instanceof Error
|
||||
? error.message
|
||||
: "Internal Server Error" });
|
||||
|
@ -53,8 +53,7 @@ export const submitAppealHandler = async(
|
||||
await sendMail("appeal", data);
|
||||
await response.send({ success: true });
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- we bein' lazy.
|
||||
await logger.error("/submit/appeals", error as Error);
|
||||
await logger.error("/submit/appeals", error);
|
||||
await response.status(500).send({ error: error instanceof Error
|
||||
? error.message
|
||||
: "Internal Server Error" });
|
||||
|
@ -55,8 +55,7 @@ export const submitCommissionHandler = async(
|
||||
await sendMail("commissions", data);
|
||||
await response.send({ success: true });
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- we bein' lazy.
|
||||
await logger.error("/submit/commissions", error as Error);
|
||||
await logger.error("/submit/commissions", error);
|
||||
await response.status(500).send({ error: error instanceof Error
|
||||
? error.message
|
||||
: "Internal Server Error" });
|
||||
|
@ -55,8 +55,7 @@ export const submitContactHandler = async(
|
||||
await sendMail("contact", data);
|
||||
await response.send({ success: true });
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- we bein' lazy.
|
||||
await logger.error("/submit/contacts", error as Error);
|
||||
await logger.error("/submit/contacts", error);
|
||||
await response.status(500).send({ error: error instanceof Error
|
||||
? error.message
|
||||
: "Internal Server Error" });
|
||||
|
@ -55,8 +55,7 @@ export const submitEventHandler = async(
|
||||
await sendMail("event", data);
|
||||
await response.send({ success: true });
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- we bein' lazy.
|
||||
await logger.error("/submit/events", error as Error);
|
||||
await logger.error("/submit/events", error);
|
||||
await response.status(500).send({ error: error instanceof Error
|
||||
? error.message
|
||||
: "Internal Server Error" });
|
||||
|
@ -55,8 +55,7 @@ export const submitMeetingHandler = async(
|
||||
await sendMail("meeting", data);
|
||||
await response.send({ success: true });
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- we bein' lazy.
|
||||
await logger.error("/submit/meetings", error as Error);
|
||||
await logger.error("/submit/meetings", error);
|
||||
await response.status(500).send({ error: error instanceof Error
|
||||
? error.message
|
||||
: "Internal Server Error" });
|
||||
|
@ -55,8 +55,7 @@ export const submitMentorshipHandler = async(
|
||||
await sendMail("mentorship", data);
|
||||
await response.send({ success: true });
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- we bein' lazy.
|
||||
await logger.error("/submit/mentorships", error as Error);
|
||||
await logger.error("/submit/mentorships", error);
|
||||
await response.status(500).send({ error: error instanceof Error
|
||||
? error.message
|
||||
: "Internal Server Error" });
|
||||
|
@ -55,8 +55,7 @@ export const submitStaffHandler = async(
|
||||
await sendMail("staff", data);
|
||||
await response.send({ success: true });
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- we bein' lazy.
|
||||
await logger.error("/submit/staff", error as Error);
|
||||
await logger.error("/submit/staff", error);
|
||||
await response.status(500).send({ error: error instanceof Error
|
||||
? error.message
|
||||
: "Internal Server Error" });
|
||||
|
@ -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" });
|
||||
}
|
||||
};
|
@ -4,7 +4,6 @@
|
||||
* @author Naomi Carrigan
|
||||
*/
|
||||
|
||||
import cors from "@fastify/cors";
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
import fastify from "fastify";
|
||||
import { authHook } from "./hooks/auth.js";
|
||||
@ -26,10 +25,6 @@ try {
|
||||
logger: false,
|
||||
});
|
||||
|
||||
server.register(cors, {
|
||||
origin: "*",
|
||||
});
|
||||
|
||||
server.addHook("preHandler", authHook);
|
||||
server.addHook("preHandler", corsHook);
|
||||
|
||||
|
@ -9,5 +9,4 @@ export type DatabasePath = | "appeals"
|
||||
| "events"
|
||||
| "meetings"
|
||||
| "mentorships"
|
||||
| "staff"
|
||||
| "testimonials";
|
||||
| "staff";
|
||||
|
@ -14,7 +14,6 @@ import type {
|
||||
Mentorships,
|
||||
PrismaClient,
|
||||
Staff,
|
||||
Testimonials,
|
||||
} from "@prisma/client";
|
||||
|
||||
/**
|
||||
@ -28,17 +27,10 @@ const listUnreviewedSubmissions = async(
|
||||
route: DatabasePath,
|
||||
): Promise<
|
||||
Array<
|
||||
| Appeals
|
||||
| Commissions
|
||||
| Contacts
|
||||
| Events
|
||||
| Meetings
|
||||
| Mentorships
|
||||
| Staff
|
||||
| Testimonials
|
||||
Appeals | Commissions | Contacts | Events | Meetings | Mentorships | Staff
|
||||
>
|
||||
> => {
|
||||
const query = {};
|
||||
const query = { };
|
||||
switch (route) {
|
||||
case "appeals":
|
||||
return await database.appeals.findMany(query);
|
||||
@ -54,8 +46,6 @@ const listUnreviewedSubmissions = async(
|
||||
return await database.mentorships.findMany(query);
|
||||
case "staff":
|
||||
return await database.staff.findMany(query);
|
||||
case "testimonials":
|
||||
return await database.testimonials.findMany(query);
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
@ -89,8 +79,6 @@ const checkSubmissionExists = async(
|
||||
return Boolean(await database.mentorships.findUnique(query));
|
||||
case "staff":
|
||||
return Boolean(await database.staff.findUnique(query));
|
||||
case "testimonials":
|
||||
return Boolean(await database.testimonials.findUnique(query));
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@ -134,9 +122,6 @@ const markSubmissionReviewed = async(
|
||||
case "staff":
|
||||
await database.staff.delete(update);
|
||||
break;
|
||||
case "testimonials":
|
||||
await database.testimonials.delete(update);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -70,12 +70,6 @@ const validators: Record<DatabasePath, Array<string>> = {
|
||||
"difficultSituation",
|
||||
"leadershipSituation",
|
||||
],
|
||||
testimonials: [
|
||||
"firstName",
|
||||
"lastName",
|
||||
"email",
|
||||
"content",
|
||||
],
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -22,7 +22,6 @@ export const listRoutes: WrappedRoute = (database) => {
|
||||
"meetings",
|
||||
"mentorships",
|
||||
"staff",
|
||||
"testimonials",
|
||||
];
|
||||
for (const route of routes) {
|
||||
fastify.get(`/list/${route}`, async(_request, response) => {
|
||||
|
@ -27,7 +27,6 @@ export const reviewRoutes: WrappedRoute = (database) => {
|
||||
"meetings",
|
||||
"mentorships",
|
||||
"staff",
|
||||
"testimonials",
|
||||
];
|
||||
for (const route of routes) {
|
||||
fastify.put<{
|
||||
|
@ -13,8 +13,6 @@ import { submitMeetingHandler } from "../handlers/submit/meetingHandler.js";
|
||||
import { submitMentorshipHandler }
|
||||
from "../handlers/submit/mentorshipHandler.js";
|
||||
import { submitStaffHandler } from "../handlers/submit/staffHandler.js";
|
||||
import { submitTestimonialHandler }
|
||||
from "../handlers/submit/testimonialHandler.js";
|
||||
import type { WrappedRoute } from "../interfaces/wrappedRoute.js";
|
||||
import type {
|
||||
Appeal,
|
||||
@ -26,7 +24,6 @@ import type {
|
||||
Staff,
|
||||
ErrorResponse,
|
||||
SuccessResponse,
|
||||
Testimonial,
|
||||
} from "@repo/types";
|
||||
|
||||
/**
|
||||
@ -34,7 +31,6 @@ import type {
|
||||
* @param database - The Prisma client.
|
||||
* @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) => {
|
||||
return async(fastify) => {
|
||||
fastify.post<{ Body: Appeal; Reply: SuccessResponse | ErrorResponse }>(
|
||||
@ -85,12 +81,5 @@ export const submitRoutes: WrappedRoute = (database) => {
|
||||
await submitStaffHandler(database, request, response);
|
||||
},
|
||||
);
|
||||
|
||||
fastify.post<{ Body: Testimonial; Reply: SuccessResponse | ErrorResponse }>(
|
||||
"/submit/testimonials",
|
||||
async(request, response) => {
|
||||
await submitTestimonialHandler(database, request, response);
|
||||
},
|
||||
);
|
||||
};
|
||||
};
|
||||
|
@ -5,10 +5,6 @@
|
||||
"dependsOn": ["^lint"],
|
||||
"outputs": ["prod/**"]
|
||||
},
|
||||
"test": {
|
||||
"dependsOn": [],
|
||||
"outputs": []
|
||||
},
|
||||
"lint": {
|
||||
"dependsOn": [],
|
||||
"outputs": []
|
||||
|
Reference in New Issue
Block a user