Compare commits
	
		
			7 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						
						
							
						
						bacfc437f9
	
				 | 
					
					
						|||
| 
						
						
							
						
						ce9b765b81
	
				 | 
					
					
						|||
| 
						
						
							
						
						2ab6e985e3
	
				 | 
					
					
						|||
| 
						
						
							
						
						d06f6a4407
	
				 | 
					
					
						|||
| 
						
						
							
						
						a50d72f2f5
	
				 | 
					
					
						|||
| 
						
						
							
						
						4723d9738e
	
				 | 
					
					
						|||
| 
						
						
							
						
						1a478bd784
	
				 | 
					
					
						
							
								
								
									
										22
									
								
								CHANGELOG.md
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								CHANGELOG.md
									
									
									
									
									
								
							@@ -2,9 +2,31 @@
 | 
			
		||||
 | 
			
		||||
All notable changes to this project will be documented in this file. Dates are displayed in UTC.
 | 
			
		||||
 | 
			
		||||
#### [1.3.12](https://git.odit.services/lfk/backend/compare/1.3.11...1.3.12)
 | 
			
		||||
 | 
			
		||||
- refactor: make Donation.donor optional [`2ab6e98`](https://git.odit.services/lfk/backend/commit/2ab6e985e356f0f3d8637d81630d191cc11b8806)
 | 
			
		||||
- refactor(config): improve consola error logs [`ce9b765`](https://git.odit.services/lfk/backend/commit/ce9b765b81b014623e79ce64d8d835f1f86cecf3)
 | 
			
		||||
 | 
			
		||||
#### [1.3.11](https://git.odit.services/lfk/backend/compare/1.3.10...1.3.11)
 | 
			
		||||
 | 
			
		||||
> 17 April 2025
 | 
			
		||||
 | 
			
		||||
- feat(RunnerController): add selfservice_links parameter to getRunners method [`a50d72f`](https://git.odit.services/lfk/backend/commit/a50d72f2f5281b8c28ca64a0970161a35a7af95a)
 | 
			
		||||
- chore(release): 1.3.11 [`d06f6a4`](https://git.odit.services/lfk/backend/commit/d06f6a44072971d1853411b255f9b49eb423b3a2)
 | 
			
		||||
 | 
			
		||||
#### [1.3.10](https://git.odit.services/lfk/backend/compare/1.3.9...1.3.10)
 | 
			
		||||
 | 
			
		||||
> 11 April 2025
 | 
			
		||||
 | 
			
		||||
- chore(release): 1.3.10 [`4723d97`](https://git.odit.services/lfk/backend/commit/4723d9738eacd63fb41f23c628fbe4181bd126de)
 | 
			
		||||
- feat(RunnerController.getAll): debug created_via query param filter [`1a478bd`](https://git.odit.services/lfk/backend/commit/1a478bd784e01b9d5a1c6635d1004a9535c9a0e9)
 | 
			
		||||
 | 
			
		||||
#### [1.3.9](https://git.odit.services/lfk/backend/compare/1.3.8...1.3.9)
 | 
			
		||||
 | 
			
		||||
> 9 April 2025
 | 
			
		||||
 | 
			
		||||
- feat(RunnerController.getAll): add created_via query param filter [`6e63c57`](https://git.odit.services/lfk/backend/commit/6e63c57936f06a29da5f1a94b1141d51b75df5f0)
 | 
			
		||||
- chore(release): 1.3.9 [`284cb0f`](https://git.odit.services/lfk/backend/commit/284cb0f8b3955d0d65c2b36d2ec427a39752ffe7)
 | 
			
		||||
 | 
			
		||||
#### [1.3.8](https://git.odit.services/lfk/backend/compare/1.3.7...1.3.8)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "@odit/lfk-backend",
 | 
			
		||||
  "version": "1.3.9",
 | 
			
		||||
  "version": "1.3.12",
 | 
			
		||||
  "main": "src/app.ts",
 | 
			
		||||
  "repository": "https://git.odit.services/lfk/backend",
 | 
			
		||||
  "author": {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,4 @@
 | 
			
		||||
import consola from 'consola';
 | 
			
		||||
import { config as configDotenv } from 'dotenv';
 | 
			
		||||
import { CountryCode } from 'libphonenumber-js';
 | 
			
		||||
import ValidatorJS from 'validator';
 | 
			
		||||
@@ -20,12 +21,15 @@ export const config = {
 | 
			
		||||
}
 | 
			
		||||
let errors = 0
 | 
			
		||||
if (typeof config.internal_port !== "number") {
 | 
			
		||||
    consola.error("Error: APP_PORT is not a number")
 | 
			
		||||
    errors++
 | 
			
		||||
}
 | 
			
		||||
if (typeof config.development !== "boolean") {
 | 
			
		||||
    consola.error("Error: NODE_ENV is not a boolean")
 | 
			
		||||
    errors++
 | 
			
		||||
}
 | 
			
		||||
if (config.mailer_url == "" || config.mailer_key == "") {
 | 
			
		||||
    consola.error("Error: invalid mailer config")
 | 
			
		||||
    errors++;
 | 
			
		||||
}
 | 
			
		||||
function getPhoneCodeLocale(): CountryCode {
 | 
			
		||||
 
 | 
			
		||||
@@ -34,6 +34,7 @@ export class RunnerController {
 | 
			
		||||
		let responseRunners: ResponseRunner[] = new Array<ResponseRunner>();
 | 
			
		||||
		let runners: Array<Runner>;
 | 
			
		||||
 | 
			
		||||
		console.log("call to RunnerController.getAll() with page: " + page + " and page_size: " + page_size + " and created_via: " + created_via + " and selfservice_links: " + selfservice_links);
 | 
			
		||||
		if (page != undefined) {
 | 
			
		||||
			runners = await this.runnerRepository.find({ relations: ['scans', 'group', 'group.parentGroup', 'scans.track'], skip: page * page_size, take: page_size });
 | 
			
		||||
		} else {
 | 
			
		||||
 
 | 
			
		||||
@@ -62,13 +62,13 @@ export class RunnerOrganizationController {
 | 
			
		||||
	@ResponseSchema(ResponseRunner, { isArray: true })
 | 
			
		||||
	@ResponseSchema(RunnerOrganizationNotFoundError, { statusCode: 404 })
 | 
			
		||||
	@OpenAPI({ description: 'Lists all runners from this org and it\'s teams (if you don\'t provide the ?onlyDirect=true param). <br> This includes the runner\'s group and distance ran.' })
 | 
			
		||||
	async getRunners(@Param('id') id: number, @QueryParam('onlyDirect') onlyDirect: boolean) {
 | 
			
		||||
	async getRunners(@Param('id') id: number, @QueryParam('onlyDirect') onlyDirect: boolean, @QueryParam("selfservice_links", { required: false }) selfservice_links: boolean = false) {
 | 
			
		||||
		let responseRunners: ResponseRunner[] = new Array<ResponseRunner>();
 | 
			
		||||
		let runners: Runner[];
 | 
			
		||||
		if (!onlyDirect) { runners = (await this.runnerOrganizationRepository.findOne({ id: id }, { relations: ['runners', 'runners.group', 'runners.group.parentGroup', 'runners.scans', 'runners.scans.track', 'teams', 'teams.runners', 'teams.runners.group', 'teams.runners.group.parentGroup', 'teams.runners.scans', 'teams.runners.scans.track'] })).allRunners; }
 | 
			
		||||
		else { runners = (await this.runnerOrganizationRepository.findOne({ id: id }, { relations: ['runners', 'runners.group', 'runners.group.parentGroup', 'runners.scans', 'runners.scans.track'] })).runners; }
 | 
			
		||||
		runners.forEach(runner => {
 | 
			
		||||
			responseRunners.push(new ResponseRunner(runner));
 | 
			
		||||
			responseRunners.push(new ResponseRunner(runner, selfservice_links));
 | 
			
		||||
		});
 | 
			
		||||
		return responseRunners;
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -60,11 +60,11 @@ export class RunnerTeamController {
 | 
			
		||||
	@ResponseSchema(ResponseRunner, { isArray: true })
 | 
			
		||||
	@ResponseSchema(RunnerTeamNotFoundError, { statusCode: 404 })
 | 
			
		||||
	@OpenAPI({ description: 'Lists all runners from this team. <br> This includes the runner\'s group and distance ran.' })
 | 
			
		||||
	async getRunners(@Param('id') id: number) {
 | 
			
		||||
	async getRunners(@Param('id') id: number, @QueryParam("selfservice_links", { required: false }) selfservice_links: boolean = false) {
 | 
			
		||||
		let responseRunners: ResponseRunner[] = new Array<ResponseRunner>();
 | 
			
		||||
		const runners = (await this.runnerTeamRepository.findOne({ id: id }, { relations: ['runners', 'runners.group', 'runners.group.parentGroup', 'runners.scans', 'runners.scans.track'] })).runners;
 | 
			
		||||
		runners.forEach(runner => {
 | 
			
		||||
			responseRunners.push(new ResponseRunner(runner));
 | 
			
		||||
			responseRunners.push(new ResponseRunner(runner, selfservice_links));
 | 
			
		||||
		});
 | 
			
		||||
		return responseRunners;
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,5 @@
 | 
			
		||||
import { IsInt, IsOptional, IsPositive } from 'class-validator';
 | 
			
		||||
import { getConnection } from 'typeorm';
 | 
			
		||||
import { DonorNotFoundError } from '../../../errors/DonorErrors';
 | 
			
		||||
import { Donation } from '../../entities/Donation';
 | 
			
		||||
import { Donor } from '../../entities/Donor';
 | 
			
		||||
 | 
			
		||||
@@ -14,6 +13,7 @@ export abstract class CreateDonation {
 | 
			
		||||
     */
 | 
			
		||||
    @IsInt()
 | 
			
		||||
    @IsPositive()
 | 
			
		||||
    @IsOptional()
 | 
			
		||||
    donor: number;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -33,9 +33,6 @@ export abstract class CreateDonation {
 | 
			
		||||
     */
 | 
			
		||||
    public async getDonor(): Promise<Donor> {
 | 
			
		||||
        const donor = await getConnection().getRepository(Donor).findOne({ id: this.donor });
 | 
			
		||||
        if (!donor) {
 | 
			
		||||
            throw new DonorNotFoundError();
 | 
			
		||||
        }
 | 
			
		||||
        return donor;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,6 +1,5 @@
 | 
			
		||||
import {
 | 
			
		||||
  IsInt,
 | 
			
		||||
  IsNotEmpty
 | 
			
		||||
  IsInt
 | 
			
		||||
} from "class-validator";
 | 
			
		||||
import { Column, Entity, ManyToOne, PrimaryGeneratedColumn, TableInheritance } from "typeorm";
 | 
			
		||||
import { ResponseDonation } from '../responses/ResponseDonation';
 | 
			
		||||
@@ -24,7 +23,6 @@ export abstract class Donation {
 | 
			
		||||
  /**
 | 
			
		||||
   * The donations's donor.
 | 
			
		||||
   */
 | 
			
		||||
  @IsNotEmpty()
 | 
			
		||||
  @ManyToOne(() => Donor, donor => donor.donations)
 | 
			
		||||
  donor: Donor;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -84,6 +84,6 @@ export class Runner extends Participant {
 | 
			
		||||
   * Turns this entity into it's response class.
 | 
			
		||||
   */
 | 
			
		||||
  public toResponse(): ResponseRunner {
 | 
			
		||||
    return new ResponseRunner(this);
 | 
			
		||||
    return new ResponseRunner(this, true);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user