Compare commits
40 Commits
Author | SHA1 | Date |
---|---|---|
Nicolai Ort | 38b9a772cd | |
Nicolai Ort | 618430433d | |
Nicolai Ort | 84cd398c09 | |
Nicolai Ort | 385a9bba73 | |
Nicolai Ort | 8218a452bd | |
Nicolai Ort | a77e2eb3ad | |
Nicolai Ort | d1a0bed00e | |
Nicolai Ort | 66d4770858 | |
Nicolai Ort | 80c5f9b84d | |
Nicolai Ort | 79f46cb745 | |
Nicolai Ort | de32a9862d | |
Nicolai Ort | 0e119e4834 | |
Nicolai Ort | 29c8e00477 | |
Nicolai Ort | dc6ad9cdd3 | |
Nicolai Ort | dcd754dac8 | |
Nicolai Ort | d88fb18319 | |
Nicolai Ort | 420e9c4662 | |
Nicolai Ort | 98d6a1cc64 | |
Nicolai Ort | 09ad081b37 | |
Nicolai Ort | aa0fd9cafd | |
Nicolai Ort | bae8290273 | |
Nicolai Ort | 1b799a6973 | |
Nicolai Ort | ed3b55a1e2 | |
Nicolai Ort | 97c01ce81a | |
Nicolai Ort | e96637219f | |
Nicolai Ort | 17244b0006 | |
Nicolai Ort | 67a02f06da | |
Nicolai Ort | 6b6f345618 | |
Nicolai Ort | 2ac9d3e977 | |
Nicolai Ort | 93692ec255 | |
Nicolai Ort | 99852f591e | |
Nicolai Ort | b89525746d | |
Nicolai Ort | c05834f2a1 | |
Nicolai Ort | 9bbfb4763d | |
Nicolai Ort | 22e6070e53 | |
Nicolai Ort | ba218c85e0 | |
Nicolai Ort | 644d2b06ac | |
Nicolai Ort | 8d4c8a4553 | |
Nicolai Ort | 077174a9a2 | |
Nicolai Ort | ce31b95fb7 |
43
CHANGELOG.md
43
CHANGELOG.md
|
@ -2,14 +2,54 @@
|
|||
|
||||
All notable changes to this project will be documented in this file. Dates are displayed in UTC.
|
||||
|
||||
#### [v0.1.0](https://git.odit.services/lfk/backend/compare/v0.0.12...v0.1.0)
|
||||
|
||||
- Removed useless parts from functions and updated comments [`c05834f`](https://git.odit.services/lfk/backend/commit/c05834f2a13eb838efbf61be803e4e320561718e)
|
||||
- Switched tests over to the new id-only schema [`d88fb18`](https://git.odit.services/lfk/backend/commit/d88fb183198e66cadf5290c1ef7b7e4ccedad4f0)
|
||||
- 🧾New changelog file version [CI SKIP] [skip ci] [`0e119e4`](https://git.odit.services/lfk/backend/commit/0e119e48340cd0a602a08da727b480aa2fe5500c)
|
||||
- Refactoring: switched update team parent from objects to ids [`ed3b55a`](https://git.odit.services/lfk/backend/commit/ed3b55a1e2b6a8dd21c43d28e9fe69d86c327c27)
|
||||
- Refactoring: switched from objects to ids [`6b6f345`](https://git.odit.services/lfk/backend/commit/6b6f3456183091468796e13e149db4d553d39155)
|
||||
- Switched to full update from partial and resolved relation [`bae8290`](https://git.odit.services/lfk/backend/commit/bae8290273aa7b7436ea14a05d398aeda20c6642)
|
||||
- Removed useless part from function and updated comments [`644d2b0`](https://git.odit.services/lfk/backend/commit/644d2b06ace012cb43d9d2b0ce38146b8586841f)
|
||||
- Removed useless part from function [`8d4c8a4`](https://git.odit.services/lfk/backend/commit/8d4c8a455398a77ebe6aa53f1e3cc06bc5af4b3a)
|
||||
- Refactoring: switched from objects to ids [`2ac9d3e`](https://git.odit.services/lfk/backend/commit/2ac9d3e977b8903351e5e3185f3454b4bf7763df)
|
||||
- Removed useless part from function and updated comments [`22e6070`](https://git.odit.services/lfk/backend/commit/22e6070e5316b01a50fd29a4cfda2b3d0cef81c9)
|
||||
- Fixed country code type issue [`a77e2eb`](https://git.odit.services/lfk/backend/commit/a77e2eb3ada5c646a4e18eff5ea25e9872dfb28f)
|
||||
- Refactoring: switched update org address from objects to ids [`97c01ce`](https://git.odit.services/lfk/backend/commit/97c01ce81a48170be014084df8028091c43f03f4)
|
||||
- Updated faulty getter function [`09ad081`](https://git.odit.services/lfk/backend/commit/09ad081b3727f37d1837420af6b81b5301170352)
|
||||
- Refactoring: switched update runner group from objects to ids [`e966372`](https://git.odit.services/lfk/backend/commit/e96637219ff01d5da2feeb933538748fca440cbd)
|
||||
- Clarified comments [`b895257`](https://git.odit.services/lfk/backend/commit/b89525746dbeed95a614aa863ce2cb7ff0ddfc5e)
|
||||
- Fixed broken pkg stuff [`385a9bb`](https://git.odit.services/lfk/backend/commit/385a9bba73f66242caccc74f3bfed97f383037d4)
|
||||
- Refactoring: switched update user groups from objects to ids [`aa0fd9c`](https://git.odit.services/lfk/backend/commit/aa0fd9cafd2196e2f0c93a42d6981cf125674abb)
|
||||
- 🧾New changelog file version [CI SKIP] [skip ci] [`dc6ad9c`](https://git.odit.services/lfk/backend/commit/dc6ad9cdd3d8f29ef9a15bf7ac61c7c55c57e9fb)
|
||||
- 🧾New changelog file version [CI SKIP] [skip ci] [`d1a0bed`](https://git.odit.services/lfk/backend/commit/d1a0bed00e01a0e9d8ba1165e3c6ca3dd910bd00)
|
||||
- Clarified comments [`1b799a6`](https://git.odit.services/lfk/backend/commit/1b799a697305791c3f67ac4a738c7287d1ac553e)
|
||||
- 🧾New changelog file version [CI SKIP] [skip ci] [`8218a45`](https://git.odit.services/lfk/backend/commit/8218a452bdf7550ec1eed2b0045e94ea4ae91d31)
|
||||
- 🚀Bumped version to v0.1.0 [`80c5f9b`](https://git.odit.services/lfk/backend/commit/80c5f9b84de355b4408dcffd632589a9a0e4ad2e)
|
||||
- 🧾New changelog file version [CI SKIP] [skip ci] [`79f46cb`](https://git.odit.services/lfk/backend/commit/79f46cb745e4cb4bdac7dbb6c6c2b8fdc9867592)
|
||||
- 👊 Bumped dependency [`de32a98`](https://git.odit.services/lfk/backend/commit/de32a9862db3cb73a4863a1bd50bf68b9be12316)
|
||||
- Merge pull request 'Switched to accepting ids (numbers/number arrays) feature/90-accept_objects' (#101) from feature/90-accept_objects into dev [`29c8e00`](https://git.odit.services/lfk/backend/commit/29c8e004772ac27b5e96361b7239bf61c2276400)
|
||||
- Clarified comments [`93692ec`](https://git.odit.services/lfk/backend/commit/93692ec2553ded72e72c6ec0277081a5c235ea42)
|
||||
- Clarified comments [`077174a`](https://git.odit.services/lfk/backend/commit/077174a9a2d2b97eda0c54ffe79ce3ebf61f72cc)
|
||||
- Updated faulty getter function [`420e9c4`](https://git.odit.services/lfk/backend/commit/420e9c4662ee0bbdf2503f2d77d80d541dceba07)
|
||||
- Fixed old reference [`98d6a1c`](https://git.odit.services/lfk/backend/commit/98d6a1cc641f76254e5d2dcb642f4a60f3158bf8)
|
||||
- Clarified comments [`17244b0`](https://git.odit.services/lfk/backend/commit/17244b0006e9d8b6bde53c5eebe0371122a9e30d)
|
||||
- Clarified comments [`99852f5`](https://git.odit.services/lfk/backend/commit/99852f591e1a785827c680b9c30b7855ed0ddb6f)
|
||||
- Clarified comments [`9bbfb47`](https://git.odit.services/lfk/backend/commit/9bbfb4763de71c0046da9676adcc747901296e84)
|
||||
- Made addresses optional gain [`ba218c8`](https://git.odit.services/lfk/backend/commit/ba218c85e0d2a31aaebc829e2be647f2b802a05b)
|
||||
- Removed todo [`ce31b95`](https://git.odit.services/lfk/backend/commit/ce31b95fb744705130bdec64e5933e6b1b4aa62c)
|
||||
|
||||
#### [v0.0.12](https://git.odit.services/lfk/backend/compare/v0.0.11...v0.0.12)
|
||||
|
||||
> 13 January 2021
|
||||
|
||||
- Merge pull request 'Fixed backend version related bugs' (#92) from bugfix/91-backend_version into dev [`#91`](https://git.odit.services/lfk/backend/issues/91)
|
||||
- Merge pull request 'Bugfix: resolved missing relation' (#89) from bugfix/88-user_update into dev [`#88`](https://git.odit.services/lfk/backend/issues/88)
|
||||
- Merge pull request 'Alpha Release 0.0.12' (#98) from dev into main [`881eedb`](https://git.odit.services/lfk/backend/commit/881eedbf3a792c316ade70b6a898fc16807cf648)
|
||||
- 🧾New changelog file version [CI SKIP] [skip ci] [`8cb67a8`](https://git.odit.services/lfk/backend/commit/8cb67a8d202527dcaa26d5f37b3fd03d90a897ca)
|
||||
- 📖New license file version [CI SKIP] [skip ci] [`09b16c9`](https://git.odit.services/lfk/backend/commit/09b16c980b01db3233db7cd3161e58aa33498993)
|
||||
- 🧾New changelog file version [CI SKIP] [`2947c41`](https://git.odit.services/lfk/backend/commit/2947c41a7241417d51f278d2e4f6195a3f3bc30d)
|
||||
- Switched emails to being mandetory for users [`9feeb30`](https://git.odit.services/lfk/backend/commit/9feeb302e89049843564015c2dc2820ac2886e2d)
|
||||
- 🧾New changelog file version [CI SKIP] [skip ci] [`09cb6f7`](https://git.odit.services/lfk/backend/commit/09cb6f7b2bda342a73b91a7b6909b12c2531b0e5)
|
||||
- Added a new endpoint that returns a users permissions as objects sorted into two arrays [`b01e1eb`](https://git.odit.services/lfk/backend/commit/b01e1eb8a1a36fc8e04e009cd6024495a70a10dd)
|
||||
- Added new pipeline to automagicly generate changelogs on pr to main [`6345666`](https://git.odit.services/lfk/backend/commit/6345666ae67846463f1dadeb13c0f5c46a0c74ae)
|
||||
- Updated some openapi descriptions [`0724932`](https://git.odit.services/lfk/backend/commit/0724932152278a1dce94f17835e00fd1bbd808f9)
|
||||
|
@ -50,6 +90,7 @@ All notable changes to this project will be documented in this file. Dates are d
|
|||
- Implemented fixed donation updateing [`9517df5`](https://git.odit.services/lfk/backend/commit/9517df50826aff1a1cb03e611b990de5829e2132)
|
||||
- Added donation get tests [`63506da`](https://git.odit.services/lfk/backend/commit/63506dac1c86e4bf4cfae9d4b94d98ac3856bbaa)
|
||||
- Added cascading runner deletion tests [`b729a7c`](https://git.odit.services/lfk/backend/commit/b729a7ceadf25787066ddc4d9cb5f08d140c4cd8)
|
||||
- Switched emails to being mandetory for users [`9feeb30`](https://git.odit.services/lfk/backend/commit/9feeb302e89049843564015c2dc2820ac2886e2d)
|
||||
- Implemented donation getting [`0df26cb`](https://git.odit.services/lfk/backend/commit/0df26cbd54bf914166bcb9ac1b03dee0c5dba07d)
|
||||
- Implemented distance donation updateing [`f7370bc`](https://git.odit.services/lfk/backend/commit/f7370bc8025f9a29b4c046ec1dd28b128398dab9)
|
||||
- Implmented cascading donation deletion for runners and donors [`e716fae`](https://git.odit.services/lfk/backend/commit/e716fae1c5eec625e6d050ac8893dfbe2ff1d820)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@odit/lfk-backend",
|
||||
"version": "0.0.12",
|
||||
"version": "0.1.0",
|
||||
"main": "src/app.ts",
|
||||
"repository": "https://git.odit.services/lfk/backend",
|
||||
"author": {
|
||||
|
@ -22,11 +22,11 @@
|
|||
],
|
||||
"license": "CC-BY-NC-SA-4.0",
|
||||
"dependencies": {
|
||||
"@odit/class-validator-jsonschema": "2.1.1",
|
||||
"argon2": "^0.27.1",
|
||||
"body-parser": "^1.19.0",
|
||||
"class-transformer": "^0.3.1",
|
||||
"class-validator": "^0.12.2",
|
||||
"class-validator-jsonschema": "^2.1.0",
|
||||
"class-transformer": "0.3.1",
|
||||
"class-validator": "^0.13.1",
|
||||
"consola": "^2.15.0",
|
||||
"cookie": "^0.4.1",
|
||||
"cookie-parser": "^1.4.5",
|
||||
|
@ -35,6 +35,7 @@
|
|||
"dotenv": "^8.2.0",
|
||||
"express": "^4.17.1",
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"libphonenumber-js": "^1.9.7",
|
||||
"mysql": "^2.18.1",
|
||||
"pg": "^8.5.1",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { validationMetadatasToSchemas } from 'class-validator-jsonschema';
|
||||
import { validationMetadatasToSchemas } from '@odit/class-validator-jsonschema';
|
||||
import consola from "consola";
|
||||
import fs from "fs";
|
||||
import "reflect-metadata";
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { config as configDotenv } from 'dotenv';
|
||||
import { CountryCode } from 'libphonenumber-js';
|
||||
import ValidatorJS from 'validator';
|
||||
|
||||
configDotenv();
|
||||
|
@ -6,7 +7,7 @@ export const config = {
|
|||
internal_port: parseInt(process.env.APP_PORT) || 4010,
|
||||
development: process.env.NODE_ENV === "production",
|
||||
jwt_secret: process.env.JWT_SECRET || "secretjwtsecret",
|
||||
phone_validation_countrycode: process.env.PHONE_COUNTRYCODE || "ZZ",
|
||||
phone_validation_countrycode: getPhoneCodeLocale(),
|
||||
postalcode_validation_countrycode: getPostalCodeLocale(),
|
||||
version: process.env.VERSION || require('../package.json').version
|
||||
}
|
||||
|
@ -14,15 +15,12 @@ let errors = 0
|
|||
if (typeof config.internal_port !== "number") {
|
||||
errors++
|
||||
}
|
||||
if (typeof config.phone_validation_countrycode !== "string") {
|
||||
errors++
|
||||
}
|
||||
if (config.phone_validation_countrycode.length !== 2) {
|
||||
errors++
|
||||
}
|
||||
if (typeof config.development !== "boolean") {
|
||||
errors++
|
||||
}
|
||||
function getPhoneCodeLocale(): CountryCode {
|
||||
return (process.env.PHONE_COUNTRYCODE as CountryCode);
|
||||
}
|
||||
function getPostalCodeLocale(): any {
|
||||
try {
|
||||
const stringArray: String[] = ValidatorJS.isPostalCodeLocales;
|
||||
|
|
|
@ -90,7 +90,7 @@ export class PermissionController {
|
|||
if (oldPermission.id != permission.id) {
|
||||
throw new PermissionIdsNotMatchingError();
|
||||
}
|
||||
let existingPermission = await this.permissionRepository.findOne({ target: permission.target, action: permission.action, principal: permission.principal }, { relations: ['principal'] });
|
||||
let existingPermission = await this.permissionRepository.findOne({ target: permission.target, action: permission.action, principal: await permission.getPrincipal() }, { relations: ['principal'] });
|
||||
if (existingPermission) {
|
||||
await this.remove(permission.id, true);
|
||||
return new ResponsePermission(existingPermission);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { validationMetadatasToSchemas } from "class-validator-jsonschema";
|
||||
import { validationMetadatasToSchemas } from "@odit/class-validator-jsonschema";
|
||||
import express, { Application } from "express";
|
||||
import path from 'path';
|
||||
import { getMetadataArgsStorage } from "routing-controllers";
|
||||
|
|
|
@ -32,7 +32,6 @@ export class CreateAddress {
|
|||
/**
|
||||
* The new address's postal code.
|
||||
* This will get checked against the postal code syntax for the configured country.
|
||||
* TODO: Implement the config option.
|
||||
*/
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
|
|
|
@ -11,7 +11,7 @@ import { CreateDonation } from './CreateDonation';
|
|||
export class CreateDistanceDonation extends CreateDonation {
|
||||
|
||||
/**
|
||||
* The donation's associated runner.
|
||||
* The donation's associated runner's id.
|
||||
* This is important to link the runner's distance ran to the donation.
|
||||
*/
|
||||
@IsInt()
|
||||
|
|
|
@ -9,7 +9,7 @@ import { Donor } from '../../entities/Donor';
|
|||
*/
|
||||
export abstract class CreateDonation {
|
||||
/**
|
||||
* The donation's associated donor.
|
||||
* The donation's associated donor's id.
|
||||
* This is important to link donations to donors.
|
||||
*/
|
||||
@IsInt()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { IsEmail, IsInt, IsNotEmpty, IsOptional, IsPhoneNumber, IsString } from 'class-validator';
|
||||
import { getConnectionManager } from 'typeorm';
|
||||
import { config } from '../../../config';
|
||||
import { AddressNotFoundError, AddressWrongTypeError } from '../../../errors/AddressErrors';
|
||||
import { AddressNotFoundError } from '../../../errors/AddressErrors';
|
||||
import { Address } from '../../entities/Address';
|
||||
import { GroupContact } from '../../entities/GroupContact';
|
||||
|
||||
|
@ -31,8 +31,7 @@ export class CreateGroupContact {
|
|||
lastname: string;
|
||||
|
||||
/**
|
||||
* The new contact's address.
|
||||
* Must be the address's id.
|
||||
* The new contact's address's id.
|
||||
*/
|
||||
@IsInt()
|
||||
@IsOptional()
|
||||
|
@ -57,16 +56,10 @@ export class CreateGroupContact {
|
|||
* Gets the new contact's address by it's id.
|
||||
*/
|
||||
public async getAddress(): Promise<Address> {
|
||||
if (this.address === undefined || this.address === null) {
|
||||
return null;
|
||||
}
|
||||
if (!isNaN(this.address)) {
|
||||
let address = await getConnectionManager().get().getRepository(Address).findOne({ id: this.address });
|
||||
if (!address) { throw new AddressNotFoundError; }
|
||||
return address;
|
||||
}
|
||||
|
||||
throw new AddressWrongTypeError;
|
||||
if (!this.address) { return null; }
|
||||
let address = await getConnectionManager().get().getRepository(Address).findOne({ id: this.address });
|
||||
if (!address) { throw new AddressNotFoundError; }
|
||||
return address;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { IsEmail, IsInt, IsNotEmpty, IsOptional, IsPhoneNumber, IsString } from 'class-validator';
|
||||
import { getConnectionManager } from 'typeorm';
|
||||
import { config } from '../../../config';
|
||||
import { AddressNotFoundError, AddressWrongTypeError } from '../../../errors/AddressErrors';
|
||||
import { AddressNotFoundError } from '../../../errors/AddressErrors';
|
||||
import { Address } from '../../entities/Address';
|
||||
|
||||
/**
|
||||
|
@ -47,26 +47,19 @@ export abstract class CreateParticipant {
|
|||
email?: string;
|
||||
|
||||
/**
|
||||
* The new participant's address.
|
||||
* Must be of type number (address id).
|
||||
* The new participant's address's id.
|
||||
*/
|
||||
@IsInt()
|
||||
@IsOptional()
|
||||
address?: number;
|
||||
|
||||
/**
|
||||
* Gets the new participant's address by it's address.
|
||||
* Gets the new participant's address by it's id.
|
||||
*/
|
||||
public async getAddress(): Promise<Address> {
|
||||
if (this.address === undefined || this.address === null) {
|
||||
return null;
|
||||
}
|
||||
if (!isNaN(this.address)) {
|
||||
let address = await getConnectionManager().get().getRepository(Address).findOne({ id: this.address });
|
||||
if (!address) { throw new AddressNotFoundError; }
|
||||
return address;
|
||||
}
|
||||
|
||||
throw new AddressWrongTypeError;
|
||||
if (!this.address) { return null; }
|
||||
let address = await getConnectionManager().get().getRepository(Address).findOne({ id: this.address });
|
||||
if (!address) { throw new AddressNotFoundError; }
|
||||
return address;
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@ import { RunnerCard } from '../../entities/RunnerCard';
|
|||
*/
|
||||
export class CreateRunnerCard {
|
||||
/**
|
||||
* The card's associated runner.
|
||||
* The card's associated runner's id.
|
||||
*/
|
||||
@IsInt()
|
||||
@IsOptional()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { IsInt, IsNotEmpty, IsOptional, IsString } from 'class-validator';
|
||||
import { getConnectionManager } from 'typeorm';
|
||||
import { GroupContactNotFoundError, GroupContactWrongTypeError } from '../../../errors/GroupContactErrors';
|
||||
import { GroupContactNotFoundError } from '../../../errors/GroupContactErrors';
|
||||
import { GroupContact } from '../../entities/GroupContact';
|
||||
|
||||
/**
|
||||
|
@ -15,7 +15,7 @@ export abstract class CreateRunnerGroup {
|
|||
name: string;
|
||||
|
||||
/**
|
||||
* The new group's contact.
|
||||
* The new group's contact's id.
|
||||
* Optional
|
||||
*/
|
||||
@IsInt()
|
||||
|
@ -26,15 +26,10 @@ export abstract class CreateRunnerGroup {
|
|||
* Gets the new group's contact by it's id.
|
||||
*/
|
||||
public async getContact(): Promise<GroupContact> {
|
||||
if (this.contact === undefined || this.contact === null) {
|
||||
return null;
|
||||
}
|
||||
if (!isNaN(this.contact)) {
|
||||
let contact = await getConnectionManager().get().getRepository(GroupContact).findOne({ id: this.contact });
|
||||
if (!contact) { throw new GroupContactNotFoundError; }
|
||||
return contact;
|
||||
}
|
||||
if (!this.contact) { return null; }
|
||||
let contact = await getConnectionManager().get().getRepository(GroupContact).findOne({ id: this.contact });
|
||||
if (!contact) { throw new GroupContactNotFoundError; }
|
||||
return contact;
|
||||
|
||||
throw new GroupContactWrongTypeError;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
import { IsInt, IsOptional } from 'class-validator';
|
||||
import { getConnectionManager } from 'typeorm';
|
||||
import { AddressNotFoundError, AddressWrongTypeError } from '../../../errors/AddressErrors';
|
||||
import { AddressNotFoundError } from '../../../errors/AddressErrors';
|
||||
import { Address } from '../../entities/Address';
|
||||
import { RunnerOrganisation } from '../../entities/RunnerOrganisation';
|
||||
import { CreateRunnerGroup } from './CreateRunnerGroup';
|
||||
|
@ -10,8 +10,7 @@ import { CreateRunnerGroup } from './CreateRunnerGroup';
|
|||
*/
|
||||
export class CreateRunnerOrganisation extends CreateRunnerGroup {
|
||||
/**
|
||||
* The new organisation's address.
|
||||
* Must be of type number (address id).
|
||||
* The new organisation's address's id.
|
||||
*/
|
||||
@IsInt()
|
||||
@IsOptional()
|
||||
|
@ -21,16 +20,10 @@ export class CreateRunnerOrganisation extends CreateRunnerGroup {
|
|||
* Gets the org's address by it's id.
|
||||
*/
|
||||
public async getAddress(): Promise<Address> {
|
||||
if (this.address === undefined || this.address === null) {
|
||||
return null;
|
||||
}
|
||||
if (!isNaN(this.address)) {
|
||||
let address = await getConnectionManager().get().getRepository(Address).findOne({ id: this.address });
|
||||
if (!address) { throw new AddressNotFoundError; }
|
||||
return address;
|
||||
}
|
||||
|
||||
throw new AddressWrongTypeError;
|
||||
if (!this.address) { return null; }
|
||||
let address = await getConnectionManager().get().getRepository(Address).findOne({ id: this.address });
|
||||
if (!address) { throw new AddressNotFoundError; }
|
||||
return address;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -41,7 +34,7 @@ export class CreateRunnerOrganisation extends CreateRunnerGroup {
|
|||
|
||||
newRunnerOrganisation.name = this.name;
|
||||
newRunnerOrganisation.contact = await this.getContact();
|
||||
// newRunnerOrganisation.address = await this.getAddress();
|
||||
newRunnerOrganisation.address = await this.getAddress();
|
||||
|
||||
return newRunnerOrganisation;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { IsInt, IsNotEmpty } from 'class-validator';
|
||||
import { getConnectionManager } from 'typeorm';
|
||||
import { RunnerOrganisationNotFoundError, RunnerOrganisationWrongTypeError } from '../../../errors/RunnerOrganisationErrors';
|
||||
import { RunnerOrganisationNotFoundError } from '../../../errors/RunnerOrganisationErrors';
|
||||
import { RunnerTeamNeedsParentError } from '../../../errors/RunnerTeamErrors';
|
||||
import { RunnerOrganisation } from '../../entities/RunnerOrganisation';
|
||||
import { RunnerTeam } from '../../entities/RunnerTeam';
|
||||
|
@ -12,7 +12,7 @@ import { CreateRunnerGroup } from './CreateRunnerGroup';
|
|||
export class CreateRunnerTeam extends CreateRunnerGroup {
|
||||
|
||||
/**
|
||||
* The new team's parent group (organisation).
|
||||
* The new team's parent org's id.
|
||||
*/
|
||||
@IsInt()
|
||||
@IsNotEmpty()
|
||||
|
@ -25,13 +25,9 @@ export class CreateRunnerTeam extends CreateRunnerGroup {
|
|||
if (this.parentGroup === undefined || this.parentGroup === null) {
|
||||
throw new RunnerTeamNeedsParentError();
|
||||
}
|
||||
if (!isNaN(this.parentGroup)) {
|
||||
let parentGroup = await getConnectionManager().get().getRepository(RunnerOrganisation).findOne({ id: this.parentGroup });
|
||||
if (!parentGroup) { throw new RunnerOrganisationNotFoundError();; }
|
||||
return parentGroup;
|
||||
}
|
||||
|
||||
throw new RunnerOrganisationWrongTypeError;
|
||||
let parentGroup = await getConnectionManager().get().getRepository(RunnerOrganisation).findOne({ id: this.parentGroup });
|
||||
if (!parentGroup) { throw new RunnerOrganisationNotFoundError();; }
|
||||
return parentGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -42,7 +38,6 @@ export class CreateRunnerTeam extends CreateRunnerGroup {
|
|||
|
||||
newRunnerTeam.name = this.name;
|
||||
newRunnerTeam.parentGroup = await this.getParent();
|
||||
|
||||
newRunnerTeam.contact = await this.getContact()
|
||||
|
||||
return newRunnerTeam;
|
||||
|
|
|
@ -9,7 +9,7 @@ import { Scan } from '../../entities/Scan';
|
|||
*/
|
||||
export abstract class CreateScan {
|
||||
/**
|
||||
* The scan's associated runner.
|
||||
* The scan's associated runner's id.
|
||||
* This is important to link ran distances to runners.
|
||||
*/
|
||||
@IsInt()
|
||||
|
|
|
@ -19,7 +19,7 @@ export class CreateScanStation {
|
|||
description?: string;
|
||||
|
||||
/**
|
||||
* The station's associated track.
|
||||
* The station's associated track's id.
|
||||
*/
|
||||
@IsInt()
|
||||
@IsPositive()
|
||||
|
|
|
@ -12,7 +12,7 @@ import { TrackScan } from '../../entities/TrackScan';
|
|||
*/
|
||||
export class CreateTrackScan {
|
||||
/**
|
||||
* The runnerCard associated with the scan.
|
||||
* The id of the runnerCard associated with the scan.
|
||||
* This get's saved for documentation and management purposes.
|
||||
*/
|
||||
@IsInt()
|
||||
|
@ -20,8 +20,8 @@ export class CreateTrackScan {
|
|||
card: number;
|
||||
|
||||
/**
|
||||
* The scanning station that created the scan.
|
||||
* Mainly used for logging and traceing back scans (or errors)
|
||||
* The scanning station's id that created the scan.
|
||||
* Mainly used for logging and traceing back scans (or errors).
|
||||
*/
|
||||
@IsInt()
|
||||
@IsPositive()
|
||||
|
|
|
@ -71,7 +71,7 @@ export class CreateUser {
|
|||
enabled?: boolean = true;
|
||||
|
||||
/**
|
||||
* The new user's groups' id(s).
|
||||
* The new user's groups' ids.
|
||||
* You can provide either one groupId or an array of groupIDs.
|
||||
*/
|
||||
@IsOptional()
|
||||
|
|
|
@ -11,7 +11,7 @@ import { UpdateDonation } from './UpdateDonation';
|
|||
export class UpdateDistanceDonation extends UpdateDonation {
|
||||
|
||||
/**
|
||||
* The donation's associated runner.
|
||||
* The donation's associated runner's id.
|
||||
* This is important to link the runner's distance ran to the donation.
|
||||
*/
|
||||
@IsInt()
|
||||
|
|
|
@ -16,7 +16,7 @@ export abstract class UpdateDonation {
|
|||
id: number;
|
||||
|
||||
/**
|
||||
* The updated donation's associated donor.
|
||||
* The updated donation's associated donor's id.
|
||||
* This is important to link donations to donors.
|
||||
*/
|
||||
@IsInt()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { IsInt, IsNotEmpty, IsObject } from 'class-validator';
|
||||
import { IsInt, IsNotEmpty, IsPositive } from 'class-validator';
|
||||
import { getConnectionManager } from 'typeorm';
|
||||
import { PermissionNeedsPrincipalError } from '../../../errors/PermissionErrors';
|
||||
import { PrincipalNotFoundError, PrincipalWrongTypeError } from '../../../errors/PrincipalErrors';
|
||||
import { PrincipalNotFoundError } from '../../../errors/PrincipalErrors';
|
||||
import { Permission } from '../../entities/Permission';
|
||||
import { Principal } from '../../entities/Principal';
|
||||
import { PermissionAction } from '../../enums/PermissionAction';
|
||||
|
@ -20,12 +20,11 @@ export class UpdatePermission {
|
|||
id: number;
|
||||
|
||||
/**
|
||||
* The updated permissions's principal.
|
||||
* Just has to contain the principal's id -everything else won't be checked or changed.
|
||||
* The updated permissions's principal's id.
|
||||
*/
|
||||
@IsObject()
|
||||
@IsNotEmpty()
|
||||
principal: Principal;
|
||||
@IsInt()
|
||||
@IsPositive()
|
||||
principal: number;
|
||||
|
||||
/**
|
||||
* The permissions's target.
|
||||
|
@ -57,12 +56,8 @@ export class UpdatePermission {
|
|||
if (this.principal === undefined || this.principal === null) {
|
||||
throw new PermissionNeedsPrincipalError();
|
||||
}
|
||||
if (!isNaN(this.principal.id)) {
|
||||
let principal = await getConnectionManager().get().getRepository(Principal).findOne({ id: this.principal.id });
|
||||
if (!principal) { throw new PrincipalNotFoundError(); }
|
||||
return principal;
|
||||
}
|
||||
|
||||
throw new PrincipalWrongTypeError();
|
||||
let principal = await getConnectionManager().get().getRepository(Principal).findOne({ id: this.principal });
|
||||
if (!principal) { throw new PrincipalNotFoundError(); }
|
||||
return principal;
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
import { IsInt, IsObject } from 'class-validator';
|
||||
import { IsInt, IsPositive } from 'class-validator';
|
||||
import { getConnectionManager } from 'typeorm';
|
||||
import { RunnerGroupNotFoundError } from '../../../errors/RunnerGroupErrors';
|
||||
import { RunnerOrganisationWrongTypeError } from '../../../errors/RunnerOrganisationErrors';
|
||||
import { RunnerTeamNeedsParentError } from '../../../errors/RunnerTeamErrors';
|
||||
import { Runner } from '../../entities/Runner';
|
||||
import { RunnerGroup } from '../../entities/RunnerGroup';
|
||||
|
@ -20,11 +19,11 @@ export class UpdateRunner extends CreateParticipant {
|
|||
id: number;
|
||||
|
||||
/**
|
||||
* The updated runner's new team/org.
|
||||
* Just has to contain the group's id -everything else won't be checked or changed.
|
||||
* The updated runner's group's id.
|
||||
*/
|
||||
@IsObject()
|
||||
group: RunnerGroup;
|
||||
@IsInt()
|
||||
@IsPositive()
|
||||
group: number;
|
||||
|
||||
/**
|
||||
* Updates a provided Runner entity based on this.
|
||||
|
@ -48,12 +47,8 @@ export class UpdateRunner extends CreateParticipant {
|
|||
if (this.group === undefined || this.group === null) {
|
||||
throw new RunnerTeamNeedsParentError();
|
||||
}
|
||||
if (!isNaN(this.group.id)) {
|
||||
let group = await getConnectionManager().get().getRepository(RunnerGroup).findOne({ id: this.group.id });
|
||||
if (!group) { throw new RunnerGroupNotFoundError; }
|
||||
return group;
|
||||
}
|
||||
|
||||
throw new RunnerOrganisationWrongTypeError;
|
||||
let group = await getConnectionManager().get().getRepository(RunnerGroup).findOne({ id: this.group });
|
||||
if (!group) { throw new RunnerGroupNotFoundError; }
|
||||
return group;
|
||||
}
|
||||
}
|
|
@ -17,7 +17,7 @@ export class UpdateRunnerCard {
|
|||
id?: number;
|
||||
|
||||
/**
|
||||
* The updated card's associated runner.
|
||||
* The updated card's associated runner's id.
|
||||
*/
|
||||
@IsInt()
|
||||
@IsOptional()
|
||||
|
|
|
@ -18,22 +18,18 @@ export class UpdateRunnerOrganisation extends CreateRunnerGroup {
|
|||
id: number;
|
||||
|
||||
/**
|
||||
* The updated organisation's address.
|
||||
* Just has to contain the address's id - everything else won't be checked or changed.
|
||||
* Optional.
|
||||
* The updated organisation's address's id.
|
||||
*/
|
||||
@IsInt()
|
||||
@IsOptional()
|
||||
address?: Address;
|
||||
address?: number;
|
||||
|
||||
/**
|
||||
* Loads the organisation's address based on it's id.
|
||||
*/
|
||||
public async getAddress(): Promise<Address> {
|
||||
if (this.address === undefined || this.address === null) {
|
||||
return null;
|
||||
}
|
||||
let address = await getConnectionManager().get().getRepository(Address).findOne({ id: this.address.id });
|
||||
if (!this.address) { return null; }
|
||||
let address = await getConnectionManager().get().getRepository(Address).findOne({ id: this.address });
|
||||
if (!address) { throw new AddressNotFoundError; }
|
||||
return address;
|
||||
}
|
||||
|
@ -45,7 +41,7 @@ export class UpdateRunnerOrganisation extends CreateRunnerGroup {
|
|||
|
||||
organisation.name = this.name;
|
||||
organisation.contact = await this.getContact();
|
||||
// organisation.address = await this.getAddress();
|
||||
organisation.address = await this.getAddress();
|
||||
|
||||
return organisation;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { IsInt, IsNotEmpty, IsObject } from 'class-validator';
|
||||
import { IsInt, IsPositive } from 'class-validator';
|
||||
import { getConnectionManager } from 'typeorm';
|
||||
import { RunnerOrganisationNotFoundError, RunnerOrganisationWrongTypeError } from '../../../errors/RunnerOrganisationErrors';
|
||||
import { RunnerOrganisationNotFoundError } from '../../../errors/RunnerOrganisationErrors';
|
||||
import { RunnerTeamNeedsParentError } from '../../../errors/RunnerTeamErrors';
|
||||
import { RunnerOrganisation } from '../../entities/RunnerOrganisation';
|
||||
import { RunnerTeam } from '../../entities/RunnerTeam';
|
||||
|
@ -19,12 +19,11 @@ export class UpdateRunnerTeam extends CreateRunnerGroup {
|
|||
id: number;
|
||||
|
||||
/**
|
||||
* The updated team's parentGroup.
|
||||
* Just has to contain the organisation's id - everything else won't be checked or changed.
|
||||
* The updated team's parentGroup's id.
|
||||
*/
|
||||
@IsObject()
|
||||
@IsNotEmpty()
|
||||
parentGroup: RunnerOrganisation;
|
||||
@IsInt()
|
||||
@IsPositive()
|
||||
parentGroup: number;
|
||||
|
||||
/**
|
||||
* Loads the updated teams's parentGroup based on it's id.
|
||||
|
@ -33,13 +32,9 @@ export class UpdateRunnerTeam extends CreateRunnerGroup {
|
|||
if (this.parentGroup === undefined || this.parentGroup === null) {
|
||||
throw new RunnerTeamNeedsParentError();
|
||||
}
|
||||
if (!isNaN(this.parentGroup.id)) {
|
||||
let parentGroup = await getConnectionManager().get().getRepository(RunnerOrganisation).findOne({ id: this.parentGroup.id });
|
||||
if (!parentGroup) { throw new RunnerOrganisationNotFoundError();; }
|
||||
return parentGroup;
|
||||
}
|
||||
|
||||
throw new RunnerOrganisationWrongTypeError;
|
||||
let parentGroup = await getConnectionManager().get().getRepository(RunnerOrganisation).findOne({ id: this.parentGroup });
|
||||
if (!parentGroup) { throw new RunnerOrganisationNotFoundError();; }
|
||||
return parentGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,7 +16,7 @@ export abstract class UpdateScan {
|
|||
id: number;
|
||||
|
||||
/**
|
||||
* The updated scan's associated runner.
|
||||
* The updated scan's associated runner's id.
|
||||
* This is important to link ran distances to runners.
|
||||
*/
|
||||
@IsInt()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { IsBoolean, IsInt, IsOptional } from 'class-validator';
|
||||
import { IsBoolean, IsInt, IsOptional, IsPositive } from 'class-validator';
|
||||
import { getConnection } from 'typeorm';
|
||||
import { RunnerNotFoundError } from '../../../errors/RunnerErrors';
|
||||
import { ScanStationNotFoundError } from '../../../errors/ScanStationErrors';
|
||||
|
@ -18,12 +18,12 @@ export abstract class UpdateTrackScan {
|
|||
id: number;
|
||||
|
||||
/**
|
||||
* The updated scan's associated runner.
|
||||
* The updated scan's associated runner's id.
|
||||
* This is important to link ran distances to runners.
|
||||
*/
|
||||
@IsInt()
|
||||
@IsOptional()
|
||||
runner?: number;
|
||||
@IsPositive()
|
||||
runner: number;
|
||||
|
||||
/**
|
||||
* Is the updated scan valid (for fraud reasons).
|
||||
|
@ -33,12 +33,12 @@ export abstract class UpdateTrackScan {
|
|||
valid?: boolean = true;
|
||||
|
||||
/**
|
||||
* The updated scan's associated station.
|
||||
* The updated scan's associated station's id.
|
||||
* This is important to link ran distances to runners.
|
||||
*/
|
||||
@IsInt()
|
||||
@IsOptional()
|
||||
public station?: number;
|
||||
@IsPositive()
|
||||
public station: number;
|
||||
|
||||
/**
|
||||
* Update a TrackScan entity based on this.
|
||||
|
@ -46,12 +46,8 @@ export abstract class UpdateTrackScan {
|
|||
*/
|
||||
public async update(scan: TrackScan): Promise<TrackScan> {
|
||||
scan.valid = this.valid;
|
||||
if (this.runner) {
|
||||
scan.runner = await this.getRunner();
|
||||
}
|
||||
if (this.station) {
|
||||
scan.station = await this.getStation();
|
||||
}
|
||||
scan.runner = await this.getRunner();
|
||||
scan.station = await this.getStation();
|
||||
scan.track = scan.station.track;
|
||||
|
||||
return scan;
|
||||
|
@ -72,7 +68,7 @@ export abstract class UpdateTrackScan {
|
|||
* Gets a runner based on the runner id provided via this.runner.
|
||||
*/
|
||||
public async getStation(): Promise<ScanStation> {
|
||||
const station = await getConnection().getRepository(ScanStation).findOne({ id: this.station });
|
||||
const station = await getConnection().getRepository(ScanStation).findOne({ id: this.station }, { relations: ['track'] });
|
||||
if (!station) {
|
||||
throw new ScanStationNotFoundError();
|
||||
}
|
||||
|
|
|
@ -79,11 +79,10 @@ export class UpdateUser {
|
|||
enabled: boolean = true;
|
||||
|
||||
/**
|
||||
* The updated user's groups.
|
||||
* This just has to contain the group's id - everything else won't be changed.
|
||||
* The updated user's groups' ids.
|
||||
*/
|
||||
@IsOptional()
|
||||
groups?: UserGroup[]
|
||||
groups?: number | number[]
|
||||
|
||||
/**
|
||||
* The user's profile pic (or rather a url pointing to it).
|
||||
|
@ -124,7 +123,7 @@ export class UpdateUser {
|
|||
}
|
||||
|
||||
/**
|
||||
* Loads the updated user's groups based on their ids.
|
||||
* Get's all groups for this user by their id's;
|
||||
*/
|
||||
public async getGroups() {
|
||||
if (!this.groups) { return null; }
|
||||
|
@ -133,7 +132,7 @@ export class UpdateUser {
|
|||
this.groups = [this.groups]
|
||||
}
|
||||
for (let group of this.groups) {
|
||||
let found = await getConnectionManager().get().getRepository(UserGroup).findOne({ id: group.id });
|
||||
let found = await getConnectionManager().get().getRepository(UserGroup).findOne({ id: group });
|
||||
if (!found) { throw new UserGroupNotFoundError(); }
|
||||
groups.push(found);
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ describe('POST /api/donors with errors', () => {
|
|||
"firstname": "first",
|
||||
"middlename": "middle",
|
||||
"lastname": "last",
|
||||
"address": 0
|
||||
"address": 99999999999999999999999999
|
||||
}, axios_config);
|
||||
expect(res2.status).toEqual(404);
|
||||
expect(res2.headers['content-type']).toContain("application/json")
|
||||
|
|
|
@ -43,7 +43,7 @@ describe('adding + updating name', () => {
|
|||
"id": added_team_id,
|
||||
"name": "testlelele",
|
||||
"contact": null,
|
||||
"parentGroup": added_org
|
||||
"parentGroup": added_org.id
|
||||
}, axios_config);
|
||||
expect(res3.status).toEqual(200);
|
||||
expect(res3.headers['content-type']).toContain("application/json")
|
||||
|
@ -79,6 +79,7 @@ describe('adding + try updating id (should return 406)', () => {
|
|||
});
|
||||
it('update team', async () => {
|
||||
added_team.id = added_team.id + 1;
|
||||
added_team.parentGroup = added_team.parentGroup.id;
|
||||
const res3 = await axios.put(base + '/api/teams/' + added_team_id, added_team, axios_config);
|
||||
expect(res3.status).toEqual(406);
|
||||
expect(res3.headers['content-type']).toContain("application/json")
|
||||
|
@ -117,7 +118,7 @@ describe('add+update parent org (valid)', () => {
|
|||
expect(res3.headers['content-type']).toContain("application/json")
|
||||
});
|
||||
it('update team', async () => {
|
||||
added_team.parentGroup = added_org2;
|
||||
added_team.parentGroup = added_org2.id;
|
||||
const res4 = await axios.put(base + '/api/teams/' + added_team_id, added_team, axios_config);
|
||||
let updated_team = res4.data;
|
||||
expect(res4.status).toEqual(200);
|
||||
|
@ -125,6 +126,6 @@ describe('add+update parent org (valid)', () => {
|
|||
delete added_org2.address;
|
||||
delete added_org2.contact;
|
||||
delete added_org2.teams;
|
||||
expect(updated_team).toEqual(added_team)
|
||||
expect(updated_team.parentGroup).toEqual(added_org2)
|
||||
});
|
||||
});
|
|
@ -15,15 +15,14 @@ beforeAll(async () => {
|
|||
});
|
||||
|
||||
describe('Update runner name after adding', () => {
|
||||
let added_org_id;
|
||||
let added_org;
|
||||
let added_runner;
|
||||
let updated_runner;
|
||||
it('creating a new org with just a name should return 200', async () => {
|
||||
const res1 = await axios.post(base + '/api/organisations', {
|
||||
"name": "test123"
|
||||
}, axios_config);
|
||||
let added_org = res1.data
|
||||
added_org_id = added_org.id;
|
||||
added_org = res1.data
|
||||
expect(res1.status).toEqual(200);
|
||||
expect(res1.headers['content-type']).toContain("application/json")
|
||||
});
|
||||
|
@ -31,7 +30,7 @@ describe('Update runner name after adding', () => {
|
|||
const res2 = await axios.post(base + '/api/runners', {
|
||||
"firstname": "first",
|
||||
"lastname": "last",
|
||||
"group": added_org_id
|
||||
"group": added_org.id
|
||||
}, axios_config);
|
||||
added_runner = res2.data;
|
||||
expect(res2.status).toEqual(200);
|
||||
|
@ -40,10 +39,15 @@ describe('Update runner name after adding', () => {
|
|||
it('valid update should return 200', async () => {
|
||||
let runnercopy = added_runner
|
||||
runnercopy.firstname = "second"
|
||||
runnercopy.group = added_runner.group.id;
|
||||
const res3 = await axios.put(base + '/api/runners/' + added_runner.id, runnercopy, axios_config);
|
||||
expect(res3.status).toEqual(200);
|
||||
expect(res3.headers['content-type']).toContain("application/json")
|
||||
updated_runner = res3.data
|
||||
updated_runner = res3.data;
|
||||
delete added_org.address;
|
||||
delete added_org.contact;
|
||||
delete added_org.teams;
|
||||
runnercopy.group = added_org;
|
||||
expect(updated_runner).toEqual(runnercopy);
|
||||
});
|
||||
});
|
||||
|
@ -83,13 +87,13 @@ describe('Update runner group after adding', () => {
|
|||
expect(res3.status).toEqual(200);
|
||||
expect(res3.headers['content-type']).toContain("application/json")
|
||||
});
|
||||
it('valid update should return 200', async () => {
|
||||
added_runner.group = added_org_2;
|
||||
it('valid group update should return 200', async () => {
|
||||
added_runner.group = added_org_2.id;
|
||||
const res3 = await axios.put(base + '/api/runners/' + added_runner.id, added_runner, axios_config);
|
||||
expect(res3.status).toEqual(200);
|
||||
expect(res3.headers['content-type']).toContain("application/json")
|
||||
updated_runner = res3.data
|
||||
expect(updated_runner).toEqual(added_runner);
|
||||
expect(updated_runner.group).toEqual(added_org_2);
|
||||
});
|
||||
});
|
||||
// ---------------
|
||||
|
@ -119,6 +123,7 @@ describe('Update runner id after adding(should fail)', () => {
|
|||
});
|
||||
it('invalid update should return 406', async () => {
|
||||
added_runner.id++;
|
||||
added_runner.group = added_runner.group.id;
|
||||
const res3 = await axios.put(base + '/api/runners/' + added_runner_id, added_runner, axios_config);
|
||||
expect(res3.status).toEqual(406);
|
||||
expect(res3.headers['content-type']).toContain("application/json")
|
||||
|
@ -146,9 +151,8 @@ describe('Update runner group with invalid group after adding', () => {
|
|||
expect(res2.status).toEqual(200);
|
||||
expect(res2.headers['content-type']).toContain("application/json")
|
||||
});
|
||||
it('invalid update should return 404', async () => {
|
||||
added_org.id = 0;
|
||||
added_runner.group = added_org;
|
||||
it('invalid group update should return 404', async () => {
|
||||
added_runner.group = 99999999999999999;
|
||||
const res3 = await axios.put(base + '/api/runners/' + added_runner.id, added_runner, axios_config);
|
||||
expect(res3.status).toEqual(404);
|
||||
expect(res3.headers['content-type']).toContain("application/json")
|
||||
|
|
Loading…
Reference in New Issue