Compare commits
11 Commits
1.2.0
...
f7f41d1fda
| Author | SHA1 | Date | |
|---|---|---|---|
| f7f41d1fda | |||
|
294ce3fc5a
|
|||
|
0a43f1bb5b
|
|||
|
f95b614410
|
|||
|
fcccf82d48
|
|||
|
d62ef99e9d
|
|||
|
9692569953
|
|||
|
8c6fdb2239
|
|||
|
c0d5af5d7a
|
|||
|
4008a5ee72
|
|||
|
07bf28b144
|
@@ -1,5 +1,5 @@
|
|||||||
# Typescript Build
|
# Typescript Build
|
||||||
FROM registry.odit.services/hub/library/node:21.1.0-alpine3.18 as build
|
FROM registry.odit.services/hub/library/node:21.1.0-alpine3.18 AS build
|
||||||
ARG NPM_REGISTRY_URL=https://registry.npmjs.org
|
ARG NPM_REGISTRY_URL=https://registry.npmjs.org
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ RUN pnpm run build \
|
|||||||
&& pnpm i --production --prefer-offline
|
&& pnpm i --production --prefer-offline
|
||||||
|
|
||||||
# final image
|
# final image
|
||||||
FROM registry.odit.services/hub/library/node:21.1.0-alpine3.18 as final
|
FROM registry.odit.services/hub/library/node:21.1.0-alpine3.18 AS final
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=build /app/package.json /app/package.json
|
COPY --from=build /app/package.json /app/package.json
|
||||||
COPY --from=build /app/ormconfig.js /app/ormconfig.js
|
COPY --from=build /app/ormconfig.js /app/ormconfig.js
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@odit/lfk-backend",
|
"name": "@odit/lfk-backend",
|
||||||
"version": "1.2.0",
|
"version": "1.2.1",
|
||||||
"main": "src/app.ts",
|
"main": "src/app.ts",
|
||||||
"repository": "https://git.odit.services/lfk/backend",
|
"repository": "https://git.odit.services/lfk/backend",
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ export class RunnerController {
|
|||||||
async remove(@Param("id") id: number, @QueryParam("force") force: boolean) {
|
async remove(@Param("id") id: number, @QueryParam("force") force: boolean) {
|
||||||
let runner = await this.runnerRepository.findOne({ id: id });
|
let runner = await this.runnerRepository.findOne({ id: id });
|
||||||
if (!runner) { return null; }
|
if (!runner) { return null; }
|
||||||
const responseRunner = await this.runnerRepository.findOne(runner, { relations: ['scans', 'group', 'group.parentGroup', 'scans.track', 'cards'] });
|
const responseRunner = await this.runnerRepository.findOne(runner);
|
||||||
|
|
||||||
if (!runner) {
|
if (!runner) {
|
||||||
throw new RunnerNotFoundError();
|
throw new RunnerNotFoundError();
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ export class RunnerSelfServiceController {
|
|||||||
const runner = await this.runnerRepository.findOne({ email: mail });
|
const runner = await this.runnerRepository.findOne({ email: mail });
|
||||||
if (!runner) { throw new RunnerNotFoundError(); }
|
if (!runner) { throw new RunnerNotFoundError(); }
|
||||||
|
|
||||||
if (runner.resetRequestedTimestamp > (Math.floor(Date.now() / 1000) - 60 * 15)) { throw new RunnerSelfserviceTimeoutError(); }
|
if (runner.resetRequestedTimestamp > (Math.floor(Date.now() / 1000) - 30)) { throw new RunnerSelfserviceTimeoutError(); }
|
||||||
const token = JwtCreator.createSelfService(runner);
|
const token = JwtCreator.createSelfService(runner);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ export class RunnerTeamController {
|
|||||||
async remove(@Param("id") id: number, @QueryParam("force") force: boolean) {
|
async remove(@Param("id") id: number, @QueryParam("force") force: boolean) {
|
||||||
let team = await this.runnerTeamRepository.findOne({ id: id });
|
let team = await this.runnerTeamRepository.findOne({ id: id });
|
||||||
if (!team) { return null; }
|
if (!team) { return null; }
|
||||||
let runnerTeam = await this.runnerTeamRepository.findOne(team, { relations: ['parentGroup', 'contact', 'runners'] });
|
let runnerTeam = await this.runnerTeamRepository.findOne(team, { relations: ['runners'] });
|
||||||
|
|
||||||
if (!force) {
|
if (!force) {
|
||||||
if (runnerTeam.runners.length != 0) {
|
if (runnerTeam.runners.length != 0) {
|
||||||
|
|||||||
@@ -47,14 +47,14 @@ export class RunnerEmailNeededError extends NotAcceptableError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error to throw when a runner already requested a new selfservice link in the last 24hrs.
|
* Error to throw when a runner already requested a new selfservice link in the last 30s.
|
||||||
*/
|
*/
|
||||||
export class RunnerSelfserviceTimeoutError extends NotAcceptableError {
|
export class RunnerSelfserviceTimeoutError extends NotAcceptableError {
|
||||||
@IsString()
|
@IsString()
|
||||||
name = "RunnerSelfserviceTimeoutError"
|
name = "RunnerSelfserviceTimeoutError"
|
||||||
|
|
||||||
@IsString()
|
@IsString()
|
||||||
message = "You can only reqest a new token every 24hrs."
|
message = "You can only reqest a new token every 30s."
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ export class CreateSelfServiceCitizenRunner extends CreateParticipant {
|
|||||||
public async toEntity(): Promise<Runner> {
|
public async toEntity(): Promise<Runner> {
|
||||||
let newRunner: Runner = new Runner();
|
let newRunner: Runner = new Runner();
|
||||||
|
|
||||||
|
newRunner.created_via = "selfservice";
|
||||||
newRunner.firstname = this.firstname;
|
newRunner.firstname = this.firstname;
|
||||||
newRunner.middlename = this.middlename;
|
newRunner.middlename = this.middlename;
|
||||||
newRunner.lastname = this.lastname;
|
newRunner.lastname = this.lastname;
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ export class CreateSelfServiceRunner extends CreateParticipant {
|
|||||||
public async toEntity(group: RunnerGroup): Promise<Runner> {
|
public async toEntity(group: RunnerGroup): Promise<Runner> {
|
||||||
let newRunner: Runner = new Runner();
|
let newRunner: Runner = new Runner();
|
||||||
|
|
||||||
|
newRunner.created_via = "selfservice";
|
||||||
newRunner.firstname = this.firstname;
|
newRunner.firstname = this.firstname;
|
||||||
newRunner.middlename = this.middlename;
|
newRunner.middlename = this.middlename;
|
||||||
newRunner.lastname = this.lastname;
|
newRunner.lastname = this.lastname;
|
||||||
|
|||||||
@@ -75,6 +75,14 @@ export abstract class Participant {
|
|||||||
@IsEmail()
|
@IsEmail()
|
||||||
email?: string;
|
email?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* how the participant got into the system
|
||||||
|
*/
|
||||||
|
@Column({ nullable: true, default: "backend" })
|
||||||
|
@IsOptional()
|
||||||
|
@IsEmail()
|
||||||
|
created_via?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turns this entity into it's response class.
|
* Turns this entity into it's response class.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -50,6 +50,12 @@ export abstract class ResponseParticipant implements IResponse {
|
|||||||
@IsString()
|
@IsString()
|
||||||
email?: string;
|
email?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* how the participant got into the system
|
||||||
|
*/
|
||||||
|
@IsString()
|
||||||
|
created_via?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The participant's address.
|
* The participant's address.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user