Changed organisation* to organization* in descriptions, comments and endoints ✏
ref #117
This commit is contained in:
parent
5660aecb50
commit
ef15d0d576
@ -36,7 +36,7 @@ export class ImportController {
|
|||||||
return responseRunners;
|
return responseRunners;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post('/organisations/:id/import')
|
@Post('/organizations/:id/import')
|
||||||
@ContentType("application/json")
|
@ContentType("application/json")
|
||||||
@ResponseSchema(ResponseRunner, { isArray: true, statusCode: 200 })
|
@ResponseSchema(ResponseRunner, { isArray: true, statusCode: 200 })
|
||||||
@ResponseSchema(RunnerGroupNotFoundError, { statusCode: 404 })
|
@ResponseSchema(RunnerGroupNotFoundError, { statusCode: 404 })
|
||||||
@ -78,7 +78,7 @@ export class ImportController {
|
|||||||
return await this.postJSON(importRunners, groupID);
|
return await this.postJSON(importRunners, groupID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post('/organisations/:id/import/csv')
|
@Post('/organizations/:id/import/csv')
|
||||||
@ContentType("application/json")
|
@ContentType("application/json")
|
||||||
@UseBefore(RawBodyMiddleware)
|
@UseBefore(RawBodyMiddleware)
|
||||||
@ResponseSchema(ResponseRunner, { isArray: true, statusCode: 200 })
|
@ResponseSchema(ResponseRunner, { isArray: true, statusCode: 200 })
|
||||||
|
@ -11,7 +11,7 @@ import { RunnerController } from './RunnerController';
|
|||||||
import { RunnerTeamController } from './RunnerTeamController';
|
import { RunnerTeamController } from './RunnerTeamController';
|
||||||
|
|
||||||
|
|
||||||
@JsonController('/organisations')
|
@JsonController('/organizations')
|
||||||
@OpenAPI({ security: [{ "AuthToken": [] }, { "RefreshTokenCookie": [] }] })
|
@OpenAPI({ security: [{ "AuthToken": [] }, { "RefreshTokenCookie": [] }] })
|
||||||
export class RunnerOrganisationController {
|
export class RunnerOrganisationController {
|
||||||
private runnerOrganisationRepository: Repository<RunnerOrganisation>;
|
private runnerOrganisationRepository: Repository<RunnerOrganisation>;
|
||||||
@ -26,7 +26,7 @@ export class RunnerOrganisationController {
|
|||||||
@Get()
|
@Get()
|
||||||
@Authorized("ORGANISATION:GET")
|
@Authorized("ORGANISATION:GET")
|
||||||
@ResponseSchema(ResponseRunnerOrganisation, { isArray: true })
|
@ResponseSchema(ResponseRunnerOrganisation, { isArray: true })
|
||||||
@OpenAPI({ description: 'Lists all organisations. <br> This includes their address, contact and teams (if existing/associated).' })
|
@OpenAPI({ description: 'Lists all organizations. <br> This includes their address, contact and teams (if existing/associated).' })
|
||||||
async getAll() {
|
async getAll() {
|
||||||
let responseTeams: ResponseRunnerOrganisation[] = new Array<ResponseRunnerOrganisation>();
|
let responseTeams: ResponseRunnerOrganisation[] = new Array<ResponseRunnerOrganisation>();
|
||||||
const runners = await this.runnerOrganisationRepository.find({ relations: ['contact', 'teams'] });
|
const runners = await this.runnerOrganisationRepository.find({ relations: ['contact', 'teams'] });
|
||||||
@ -41,7 +41,7 @@ export class RunnerOrganisationController {
|
|||||||
@ResponseSchema(ResponseRunnerOrganisation)
|
@ResponseSchema(ResponseRunnerOrganisation)
|
||||||
@ResponseSchema(RunnerOrganisationNotFoundError, { statusCode: 404 })
|
@ResponseSchema(RunnerOrganisationNotFoundError, { statusCode: 404 })
|
||||||
@OnUndefined(RunnerOrganisationNotFoundError)
|
@OnUndefined(RunnerOrganisationNotFoundError)
|
||||||
@OpenAPI({ description: 'Lists all information about the organisation whose id got provided.' })
|
@OpenAPI({ description: 'Lists all information about the organization whose id got provided.' })
|
||||||
async getOne(@Param('id') id: number) {
|
async getOne(@Param('id') id: number) {
|
||||||
let runnerOrg = await this.runnerOrganisationRepository.findOne({ id: id }, { relations: ['contact', 'teams'] });
|
let runnerOrg = await this.runnerOrganisationRepository.findOne({ id: id }, { relations: ['contact', 'teams'] });
|
||||||
if (!runnerOrg) { throw new RunnerOrganisationNotFoundError(); }
|
if (!runnerOrg) { throw new RunnerOrganisationNotFoundError(); }
|
||||||
@ -70,7 +70,7 @@ export class RunnerOrganisationController {
|
|||||||
@ResponseSchema(ResponseRunnerOrganisation)
|
@ResponseSchema(ResponseRunnerOrganisation)
|
||||||
@ResponseSchema(RunnerOrganisationNotFoundError, { statusCode: 404 })
|
@ResponseSchema(RunnerOrganisationNotFoundError, { statusCode: 404 })
|
||||||
@ResponseSchema(RunnerOrganisationIdsNotMatchingError, { statusCode: 406 })
|
@ResponseSchema(RunnerOrganisationIdsNotMatchingError, { statusCode: 406 })
|
||||||
@OpenAPI({ description: "Update the organisation whose id you provided. <br> Please remember that ids can't be changed." })
|
@OpenAPI({ description: "Update the organization whose id you provided. <br> Please remember that ids can't be changed." })
|
||||||
async put(@Param('id') id: number, @Body({ validate: true }) updateOrganisation: UpdateRunnerOrganisation) {
|
async put(@Param('id') id: number, @Body({ validate: true }) updateOrganisation: UpdateRunnerOrganisation) {
|
||||||
let oldRunnerOrganisation = await this.runnerOrganisationRepository.findOne({ id: id });
|
let oldRunnerOrganisation = await this.runnerOrganisationRepository.findOne({ id: id });
|
||||||
|
|
||||||
@ -94,11 +94,11 @@ export class RunnerOrganisationController {
|
|||||||
@ResponseSchema(RunnerOrganisationHasTeamsError, { statusCode: 406 })
|
@ResponseSchema(RunnerOrganisationHasTeamsError, { statusCode: 406 })
|
||||||
@ResponseSchema(RunnerOrganisationHasRunnersError, { statusCode: 406 })
|
@ResponseSchema(RunnerOrganisationHasRunnersError, { statusCode: 406 })
|
||||||
@OnUndefined(204)
|
@OnUndefined(204)
|
||||||
@OpenAPI({ description: 'Delete the organsisation whose id you provided. <br> If the organisation still has runners and/or teams associated this will fail. <br> To delete the organisation with all associated runners and teams set the force QueryParam to true (cascading deletion might take a while). <br> This won\'t delete the associated contact. <br> If no organisation with this id exists it will just return 204(no content).' })
|
@OpenAPI({ description: 'Delete the organsisation whose id you provided. <br> If the organization still has runners and/or teams associated this will fail. <br> To delete the organization with all associated runners and teams set the force QueryParam to true (cascading deletion might take a while). <br> This won\'t delete the associated contact. <br> If no organization with this id exists it will just return 204(no content).' })
|
||||||
async remove(@Param("id") id: number, @QueryParam("force") force: boolean) {
|
async remove(@Param("id") id: number, @QueryParam("force") force: boolean) {
|
||||||
let organisation = await this.runnerOrganisationRepository.findOne({ id: id });
|
let organization = await this.runnerOrganisationRepository.findOne({ id: id });
|
||||||
if (!organisation) { return null; }
|
if (!organization) { return null; }
|
||||||
let runnerOrganisation = await this.runnerOrganisationRepository.findOne(organisation, { relations: ['contact', 'runners', 'teams'] });
|
let runnerOrganisation = await this.runnerOrganisationRepository.findOne(organization, { relations: ['contact', 'runners', 'teams'] });
|
||||||
|
|
||||||
if (!force) {
|
if (!force) {
|
||||||
if (runnerOrganisation.teams.length != 0) {
|
if (runnerOrganisation.teams.length != 0) {
|
||||||
@ -121,7 +121,7 @@ export class RunnerOrganisationController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const responseOrganisation = new ResponseRunnerOrganisation(runnerOrganisation);
|
const responseOrganisation = new ResponseRunnerOrganisation(runnerOrganisation);
|
||||||
await this.runnerOrganisationRepository.delete(organisation);
|
await this.runnerOrganisationRepository.delete(organization);
|
||||||
return responseOrganisation;
|
return responseOrganisation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ export class RunnerSelfServiceController {
|
|||||||
@Post('/register/:token')
|
@Post('/register/:token')
|
||||||
@ResponseSchema(ResponseSelfServiceRunner)
|
@ResponseSchema(ResponseSelfServiceRunner)
|
||||||
@ResponseSchema(RunnerOrganisationNotFoundError, { statusCode: 404 })
|
@ResponseSchema(RunnerOrganisationNotFoundError, { statusCode: 404 })
|
||||||
@OpenAPI({ description: 'Create a new selfservice runner in a provided org. <br> The orgs get provided and authorized via api tokens that can be optained via the /organisations endpoint.' })
|
@OpenAPI({ description: 'Create a new selfservice runner in a provided org. <br> The orgs get provided and authorized via api tokens that can be optained via the /organizations endpoint.' })
|
||||||
async registerOrganisationRunner(@Param('token') token: string, @Body({ validate: true }) createRunner: CreateSelfServiceRunner) {
|
async registerOrganisationRunner(@Param('token') token: string, @Body({ validate: true }) createRunner: CreateSelfServiceRunner) {
|
||||||
const org = await this.getOrgansisation(token);
|
const org = await this.getOrgansisation(token);
|
||||||
|
|
||||||
@ -85,14 +85,14 @@ export class RunnerSelfServiceController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get's a runner org by a provided registration api key.
|
* Get's a runner org by a provided registration api key.
|
||||||
* @param token The organisation's registration api token.
|
* @param token The organization's registration api token.
|
||||||
*/
|
*/
|
||||||
private async getOrgansisation(token: string): Promise<RunnerGroup> {
|
private async getOrgansisation(token: string): Promise<RunnerGroup> {
|
||||||
token = Buffer.from(token, 'base64').toString('utf8');
|
token = Buffer.from(token, 'base64').toString('utf8');
|
||||||
|
|
||||||
const organisation = await this.orgRepository.findOne({ key: token });
|
const organization = await this.orgRepository.findOne({ key: token });
|
||||||
if (!organisation) { throw new RunnerOrganisationNotFoundError; }
|
if (!organization) { throw new RunnerOrganisationNotFoundError; }
|
||||||
|
|
||||||
return organisation;
|
return organization;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -25,7 +25,7 @@ export class RunnerTeamController {
|
|||||||
@Get()
|
@Get()
|
||||||
@Authorized("TEAM:GET")
|
@Authorized("TEAM:GET")
|
||||||
@ResponseSchema(ResponseRunnerTeam, { isArray: true })
|
@ResponseSchema(ResponseRunnerTeam, { isArray: true })
|
||||||
@OpenAPI({ description: 'Lists all teams. <br> This includes their parent organisation and contact (if existing/associated).' })
|
@OpenAPI({ description: 'Lists all teams. <br> This includes their parent organization and contact (if existing/associated).' })
|
||||||
async getAll() {
|
async getAll() {
|
||||||
let responseTeams: ResponseRunnerTeam[] = new Array<ResponseRunnerTeam>();
|
let responseTeams: ResponseRunnerTeam[] = new Array<ResponseRunnerTeam>();
|
||||||
const runners = await this.runnerTeamRepository.find({ relations: ['parentGroup', 'contact'] });
|
const runners = await this.runnerTeamRepository.find({ relations: ['parentGroup', 'contact'] });
|
||||||
|
@ -94,10 +94,10 @@ export class StatsController {
|
|||||||
return responseTeams;
|
return responseTeams;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get("/organisations/distance")
|
@Get("/organizations/distance")
|
||||||
@UseBefore(StatsAuth)
|
@UseBefore(StatsAuth)
|
||||||
@ResponseSchema(ResponseStatsOrgnisation, { isArray: true })
|
@ResponseSchema(ResponseStatsOrgnisation, { isArray: true })
|
||||||
@OpenAPI({ description: "Returns the top ten organisations by distance.", security: [{ "StatsApiToken": [] }, { "AuthToken": [] }, { "RefreshTokenCookie": [] }] })
|
@OpenAPI({ description: "Returns the top ten organizations by distance.", security: [{ "StatsApiToken": [] }, { "AuthToken": [] }, { "RefreshTokenCookie": [] }] })
|
||||||
async getTopOrgsByDistance() {
|
async getTopOrgsByDistance() {
|
||||||
let orgs = await getConnection().getRepository(RunnerOrganisation).find({ relations: ['runners', 'runners.scans', 'runners.distanceDonations', 'runners.scans.track', 'teams', 'teams.runners', 'teams.runners.scans', 'teams.runners.distanceDonations', 'teams.runners.scans.track'] });
|
let orgs = await getConnection().getRepository(RunnerOrganisation).find({ relations: ['runners', 'runners.scans', 'runners.distanceDonations', 'runners.scans.track', 'teams', 'teams.runners', 'teams.runners.scans', 'teams.runners.distanceDonations', 'teams.runners.scans.track'] });
|
||||||
let topOrgs = orgs.sort((org1, org2) => org1.distance - org2.distance).slice(0, 9);
|
let topOrgs = orgs.sort((org1, org2) => org1.distance - org2.distance).slice(0, 9);
|
||||||
@ -108,10 +108,10 @@ export class StatsController {
|
|||||||
return responseOrgs;
|
return responseOrgs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get("/organisations/donations")
|
@Get("/organizations/donations")
|
||||||
@UseBefore(StatsAuth)
|
@UseBefore(StatsAuth)
|
||||||
@ResponseSchema(ResponseStatsOrgnisation, { isArray: true })
|
@ResponseSchema(ResponseStatsOrgnisation, { isArray: true })
|
||||||
@OpenAPI({ description: "Returns the top ten organisations by donations.", security: [{ "StatsApiToken": [] }, { "AuthToken": [] }, { "RefreshTokenCookie": [] }] })
|
@OpenAPI({ description: "Returns the top ten organizations by donations.", security: [{ "StatsApiToken": [] }, { "AuthToken": [] }, { "RefreshTokenCookie": [] }] })
|
||||||
async getTopOrgsByDonations() {
|
async getTopOrgsByDonations() {
|
||||||
let orgs = await getConnection().getRepository(RunnerOrganisation).find({ relations: ['runners', 'runners.scans', 'runners.distanceDonations', 'runners.scans.track', 'teams', 'teams.runners', 'teams.runners.scans', 'teams.runners.distanceDonations', 'teams.runners.scans.track'] });
|
let orgs = await getConnection().getRepository(RunnerOrganisation).find({ relations: ['runners', 'runners.scans', 'runners.distanceDonations', 'runners.scans.track', 'teams', 'teams.runners', 'teams.runners.scans', 'teams.runners.distanceDonations', 'teams.runners.scans.track'] });
|
||||||
let topOrgs = orgs.sort((org1, org2) => org1.distanceDonationAmount - org2.distanceDonationAmount).slice(0, 9);
|
let topOrgs = orgs.sort((org1, org2) => org1.distanceDonationAmount - org2.distanceDonationAmount).slice(0, 9);
|
||||||
|
@ -32,7 +32,7 @@ export class RunnerGroupNeededError extends NotAcceptableError {
|
|||||||
name = "RunnerGroupNeededError"
|
name = "RunnerGroupNeededError"
|
||||||
|
|
||||||
@IsString()
|
@IsString()
|
||||||
message = "Runner's need to be part of one group (team or organisation)! \n You provided neither."
|
message = "Runner's need to be part of one group (team or organization)! \n You provided neither."
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2,7 +2,7 @@ import { IsString } from 'class-validator';
|
|||||||
import { NotAcceptableError, NotFoundError } from 'routing-controllers';
|
import { NotAcceptableError, NotFoundError } from 'routing-controllers';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error to throw when a runner organisation couldn't be found.
|
* Error to throw when a runner organization couldn't be found.
|
||||||
*/
|
*/
|
||||||
export class RunnerOrganisationNotFoundError extends NotFoundError {
|
export class RunnerOrganisationNotFoundError extends NotFoundError {
|
||||||
@IsString()
|
@IsString()
|
||||||
@ -13,37 +13,37 @@ export class RunnerOrganisationNotFoundError extends NotFoundError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error to throw when two runner organisation's ids don't match.
|
* Error to throw when two runner organization's ids don't match.
|
||||||
* Usually occurs when a user tries to change a runner organisation's id.
|
* Usually occurs when a user tries to change a runner organization's id.
|
||||||
*/
|
*/
|
||||||
export class RunnerOrganisationIdsNotMatchingError extends NotAcceptableError {
|
export class RunnerOrganisationIdsNotMatchingError extends NotAcceptableError {
|
||||||
@IsString()
|
@IsString()
|
||||||
name = "RunnerOrganisationIdsNotMatchingError"
|
name = "RunnerOrganisationIdsNotMatchingError"
|
||||||
|
|
||||||
@IsString()
|
@IsString()
|
||||||
message = "The ids don't match! \n And if you wanted to change a runner organisation's id: This isn't allowed!"
|
message = "The ids don't match! \n And if you wanted to change a runner organization's id: This isn't allowed!"
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error to throw when a organisation still has runners associated.
|
* Error to throw when a organization still has runners associated.
|
||||||
*/
|
*/
|
||||||
export class RunnerOrganisationHasRunnersError extends NotAcceptableError {
|
export class RunnerOrganisationHasRunnersError extends NotAcceptableError {
|
||||||
@IsString()
|
@IsString()
|
||||||
name = "RunnerOrganisationHasRunnersError"
|
name = "RunnerOrganisationHasRunnersError"
|
||||||
|
|
||||||
@IsString()
|
@IsString()
|
||||||
message = "This organisation still has runners associated with it. \n If you want to delete this organisation with all it's runners and teams add `?force` to your query."
|
message = "This organization still has runners associated with it. \n If you want to delete this organization with all it's runners and teams add `?force` to your query."
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error to throw when a organisation still has teams associated.
|
* Error to throw when a organization still has teams associated.
|
||||||
*/
|
*/
|
||||||
export class RunnerOrganisationHasTeamsError extends NotAcceptableError {
|
export class RunnerOrganisationHasTeamsError extends NotAcceptableError {
|
||||||
@IsString()
|
@IsString()
|
||||||
name = "RunnerOrganisationHasTeamsError"
|
name = "RunnerOrganisationHasTeamsError"
|
||||||
|
|
||||||
@IsString()
|
@IsString()
|
||||||
message = "This organisation still has teams associated with it. \n If you want to delete this organisation with all it's runners and teams add `?force` to your query."
|
message = "This organization still has teams associated with it. \n If you want to delete this organization with all it's runners and teams add `?force` to your query."
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -54,5 +54,5 @@ export class RunnerOrganisationWrongTypeError extends NotAcceptableError {
|
|||||||
name = "RunnerOrganisationWrongTypeError"
|
name = "RunnerOrganisationWrongTypeError"
|
||||||
|
|
||||||
@IsString()
|
@IsString()
|
||||||
message = "The runner organisation must be an existing organisation's id. \n You provided a object of another type."
|
message = "The runner organization must be an existing organization's id. \n You provided a object of another type."
|
||||||
}
|
}
|
||||||
|
@ -43,5 +43,5 @@ export class RunnerTeamNeedsParentError extends NotAcceptableError {
|
|||||||
name = "RunnerTeamNeedsParentError"
|
name = "RunnerTeamNeedsParentError"
|
||||||
|
|
||||||
@IsString()
|
@IsString()
|
||||||
message = "You provided no runner organisation as this team's parent group."
|
message = "You provided no runner organization as this team's parent group."
|
||||||
}
|
}
|
@ -10,14 +10,14 @@ import { CreateRunnerGroup } from './CreateRunnerGroup';
|
|||||||
*/
|
*/
|
||||||
export class CreateRunnerOrganisation extends CreateRunnerGroup {
|
export class CreateRunnerOrganisation extends CreateRunnerGroup {
|
||||||
/**
|
/**
|
||||||
* The new organisation's address.
|
* The new organization's address.
|
||||||
*/
|
*/
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsObject()
|
@IsObject()
|
||||||
address?: Address;
|
address?: Address;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is registration enabled for the new organisation?
|
* Is registration enabled for the new organization?
|
||||||
*/
|
*/
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
|
@ -17,14 +17,14 @@ export class UpdateRunnerOrganisation extends CreateRunnerGroup {
|
|||||||
id: number;
|
id: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The updated organisation's address.
|
* The updated organization's address.
|
||||||
*/
|
*/
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsObject()
|
@IsObject()
|
||||||
address?: Address;
|
address?: Address;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is registration enabled for the updated organisation?
|
* Is registration enabled for the updated organization?
|
||||||
*/
|
*/
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
@ -33,21 +33,21 @@ export class UpdateRunnerOrganisation extends CreateRunnerGroup {
|
|||||||
/**
|
/**
|
||||||
* Updates a provided RunnerOrganisation entity based on this.
|
* Updates a provided RunnerOrganisation entity based on this.
|
||||||
*/
|
*/
|
||||||
public async update(organisation: RunnerOrganisation): Promise<RunnerOrganisation> {
|
public async update(organization: RunnerOrganisation): Promise<RunnerOrganisation> {
|
||||||
|
|
||||||
organisation.name = this.name;
|
organization.name = this.name;
|
||||||
organisation.contact = await this.getContact();
|
organization.contact = await this.getContact();
|
||||||
if (!this.address) { organisation.address.reset(); }
|
if (!this.address) { organization.address.reset(); }
|
||||||
else { organisation.address = this.address; }
|
else { organization.address = this.address; }
|
||||||
Address.validate(organisation.address);
|
Address.validate(organization.address);
|
||||||
|
|
||||||
if (this.registrationEnabled && !organisation.key) {
|
if (this.registrationEnabled && !organization.key) {
|
||||||
organisation.key = uuid.v4().toUpperCase();
|
organization.key = uuid.v4().toUpperCase();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
organisation.key = null;
|
organization.key = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return organisation;
|
return organization;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -16,7 +16,7 @@ import { Scan } from "./Scan";
|
|||||||
export class Runner extends Participant {
|
export class Runner extends Participant {
|
||||||
/**
|
/**
|
||||||
* The runner's associated group.
|
* The runner's associated group.
|
||||||
* Can be a runner team or organisation.
|
* Can be a runner team or organization.
|
||||||
*/
|
*/
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@ManyToOne(() => RunnerGroup, group => group.runners)
|
@ManyToOne(() => RunnerGroup, group => group.runners)
|
||||||
|
@ -14,21 +14,21 @@ import { RunnerTeam } from "./RunnerTeam";
|
|||||||
export class RunnerOrganisation extends RunnerGroup {
|
export class RunnerOrganisation extends RunnerGroup {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The organisations's address.
|
* The organizations's address.
|
||||||
*/
|
*/
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@Column(type => Address)
|
@Column(type => Address)
|
||||||
address?: Address;
|
address?: Address;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The organisation's teams.
|
* The organization's teams.
|
||||||
* Used to link teams to a organisation.
|
* Used to link teams to a organization.
|
||||||
*/
|
*/
|
||||||
@OneToMany(() => RunnerTeam, team => team.parentGroup, { nullable: true })
|
@OneToMany(() => RunnerTeam, team => team.parentGroup, { nullable: true })
|
||||||
teams: RunnerTeam[];
|
teams: RunnerTeam[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The organisation's api key for self-service registration.
|
* The organization's api key for self-service registration.
|
||||||
* The api key can be used for the /runners/register/:token endpoint.
|
* The api key can be used for the /runners/register/:token endpoint.
|
||||||
* Is has to be base64 encoded if used via the api (to keep url-safety).
|
* Is has to be base64 encoded if used via the api (to keep url-safety).
|
||||||
*/
|
*/
|
||||||
@ -38,7 +38,7 @@ export class RunnerOrganisation extends RunnerGroup {
|
|||||||
key?: string;
|
key?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all runners associated with this organisation (directly or indirectly via teams).
|
* Returns all runners associated with this organization (directly or indirectly via teams).
|
||||||
*/
|
*/
|
||||||
public get allRunners(): Runner[] {
|
public get allRunners(): Runner[] {
|
||||||
let returnRunners: Runner[] = new Array<Runner>();
|
let returnRunners: Runner[] = new Array<Runner>();
|
||||||
|
@ -33,7 +33,7 @@ export class ResponseRunnerOrganisation extends ResponseRunnerGroup {
|
|||||||
teams: RunnerTeam[];
|
teams: RunnerTeam[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The organisation's registration key.
|
* The organization's registration key.
|
||||||
* If registration is disabled this is null.
|
* If registration is disabled this is null.
|
||||||
*/
|
*/
|
||||||
@IsString()
|
@IsString()
|
||||||
@ -42,7 +42,7 @@ export class ResponseRunnerOrganisation extends ResponseRunnerGroup {
|
|||||||
registrationKey?: string;
|
registrationKey?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is registration enabled for the organisation?
|
* Is registration enabled for the organization?
|
||||||
*/
|
*/
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
|
@ -9,7 +9,7 @@ import { ResponseRunnerOrganisation } from './ResponseRunnerOrganisation';
|
|||||||
export class ResponseRunnerTeam extends ResponseRunnerGroup {
|
export class ResponseRunnerTeam extends ResponseRunnerGroup {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The runnerTeam's parent group (organisation).
|
* The runnerTeam's parent group (organization).
|
||||||
*/
|
*/
|
||||||
@IsObject()
|
@IsObject()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
|
@ -26,7 +26,7 @@ export class ResponseStats {
|
|||||||
total_teams: number;
|
total_teams: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The amount of organisations registered in the system.
|
* The amount of organizations registered in the system.
|
||||||
*/
|
*/
|
||||||
@IsInt()
|
@IsInt()
|
||||||
total_orgs: number;
|
total_orgs: number;
|
||||||
|
@ -35,8 +35,8 @@ export class ResponseStatsOrgnisation {
|
|||||||
donationAmount: number;
|
donationAmount: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new organisation stats response from a organisation
|
* Creates a new organization stats response from a organization
|
||||||
* @param org The organisation whoes response shall be generated - the following relations have to be resolved: runners, runners.scans, runners.distanceDonations, runners.scans.track, teams, teams.runners, teams.runners.scans, teams.runners.distanceDonations, teams.runners.scans.track
|
* @param org The organization whoes response shall be generated - the following relations have to be resolved: runners, runners.scans, runners.distanceDonations, runners.scans.track, teams, teams.runners, teams.runners.scans, teams.runners.distanceDonations, teams.runners.scans.track
|
||||||
*/
|
*/
|
||||||
public constructor(org: RunnerOrganisation) {
|
public constructor(org: RunnerOrganisation) {
|
||||||
this.name = org.name;
|
this.name = org.name;
|
||||||
|
@ -69,7 +69,7 @@ describe('POST /api/cards successfully (with runner)', () => {
|
|||||||
let added_org;
|
let added_org;
|
||||||
let added_runner;
|
let added_runner;
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res1 = await axios.post(base + '/api/organisations', {
|
const res1 = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res1.data
|
added_org = res1.data
|
||||||
|
@ -50,7 +50,7 @@ describe('adding + updating card.runner successfully', () => {
|
|||||||
let added_runner2;
|
let added_runner2;
|
||||||
let added_card;
|
let added_card;
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res1 = await axios.post(base + '/api/organisations', {
|
const res1 = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res1.data
|
added_org = res1.data
|
||||||
|
@ -108,7 +108,7 @@ describe('POST /api/contacts working (with group)', () => {
|
|||||||
let added_team;
|
let added_team;
|
||||||
let added_contact;
|
let added_contact;
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res = await axios.post(base + '/api/organisations', {
|
const res = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
delete res.data.contact;
|
delete res.data.contact;
|
||||||
|
@ -50,7 +50,7 @@ describe('add+delete (with org)', () => {
|
|||||||
let added_org;
|
let added_org;
|
||||||
let added_contact;
|
let added_contact;
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res = await axios.post(base + '/api/organisations', {
|
const res = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
delete res.data.contact;
|
delete res.data.contact;
|
||||||
@ -88,7 +88,7 @@ describe('add+delete (with team)', () => {
|
|||||||
let added_team;
|
let added_team;
|
||||||
let added_contact;
|
let added_contact;
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res = await axios.post(base + '/api/organisations', {
|
const res = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
delete res.data.contact;
|
delete res.data.contact;
|
||||||
@ -137,7 +137,7 @@ describe('add+delete (with org&team)', () => {
|
|||||||
let added_team;
|
let added_team;
|
||||||
let added_contact;
|
let added_contact;
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res = await axios.post(base + '/api/organisations', {
|
const res = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
delete res.data.contact;
|
delete res.data.contact;
|
||||||
|
@ -59,7 +59,7 @@ describe('Update contact group after adding (should work)', () => {
|
|||||||
let added_team;
|
let added_team;
|
||||||
let added_contact;
|
let added_contact;
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res = await axios.post(base + '/api/organisations', {
|
const res = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
delete res.data.contact;
|
delete res.data.contact;
|
||||||
@ -189,7 +189,7 @@ describe('Update contact group invalid after adding (should fail)', () => {
|
|||||||
let added_org;
|
let added_org;
|
||||||
let added_contact;
|
let added_contact;
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res = await axios.post(base + '/api/organisations', {
|
const res = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
delete res.data.contact;
|
delete res.data.contact;
|
||||||
|
@ -83,7 +83,7 @@ describe('POST /api/donations/distance illegally', () => {
|
|||||||
expect(res.headers['content-type']).toContain("application/json")
|
expect(res.headers['content-type']).toContain("application/json")
|
||||||
});
|
});
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res = await axios.post(base + '/api/organisations', {
|
const res = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res.data
|
added_org = res.data
|
||||||
@ -199,7 +199,7 @@ describe('POST /api/donations/distance successfully', () => {
|
|||||||
expect(res.headers['content-type']).toContain("application/json")
|
expect(res.headers['content-type']).toContain("application/json")
|
||||||
});
|
});
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res = await axios.post(base + '/api/organisations', {
|
const res = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res.data
|
added_org = res.data
|
||||||
|
@ -70,7 +70,7 @@ describe('DELETE distance donation', () => {
|
|||||||
expect(res.headers['content-type']).toContain("application/json")
|
expect(res.headers['content-type']).toContain("application/json")
|
||||||
});
|
});
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res = await axios.post(base + '/api/organisations', {
|
const res = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res.data
|
added_org = res.data
|
||||||
|
@ -73,7 +73,7 @@ describe('adding + getting distance donation', () => {
|
|||||||
expect(res.headers['content-type']).toContain("application/json")
|
expect(res.headers['content-type']).toContain("application/json")
|
||||||
});
|
});
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res = await axios.post(base + '/api/organisations', {
|
const res = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res.data
|
added_org = res.data
|
||||||
|
@ -84,7 +84,7 @@ describe('adding + updating distance donation illegally', () => {
|
|||||||
expect(res.headers['content-type']).toContain("application/json")
|
expect(res.headers['content-type']).toContain("application/json")
|
||||||
});
|
});
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res = await axios.post(base + '/api/organisations', {
|
const res = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res.data
|
added_org = res.data
|
||||||
@ -253,7 +253,7 @@ describe('adding + updating distance donation valid', () => {
|
|||||||
expect(res.headers['content-type']).toContain("application/json")
|
expect(res.headers['content-type']).toContain("application/json")
|
||||||
});
|
});
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res = await axios.post(base + '/api/organisations', {
|
const res = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res.data
|
added_org = res.data
|
||||||
|
@ -60,7 +60,7 @@ describe('DELETE donor with donations invalid', () => {
|
|||||||
expect(res.headers['content-type']).toContain("application/json")
|
expect(res.headers['content-type']).toContain("application/json")
|
||||||
});
|
});
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res = await axios.post(base + '/api/organisations', {
|
const res = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res.data
|
added_org = res.data
|
||||||
@ -115,7 +115,7 @@ describe('DELETE donor with donations valid', () => {
|
|||||||
expect(res.headers['content-type']).toContain("application/json")
|
expect(res.headers['content-type']).toContain("application/json")
|
||||||
});
|
});
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res = await axios.post(base + '/api/organisations', {
|
const res = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res.data
|
added_org = res.data
|
||||||
|
@ -14,24 +14,24 @@ beforeAll(async () => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('GET /api/organisations', () => {
|
describe('GET /api/organizations', () => {
|
||||||
it('basic get should return 200', async () => {
|
it('basic get should return 200', async () => {
|
||||||
const res = await axios.get(base + '/api/organisations', axios_config);
|
const res = await axios.get(base + '/api/organizations', axios_config);
|
||||||
expect(res.status).toEqual(200);
|
expect(res.status).toEqual(200);
|
||||||
expect(res.headers['content-type']).toContain("application/json")
|
expect(res.headers['content-type']).toContain("application/json")
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
// ---------------
|
// ---------------
|
||||||
describe('POST /api/organisations', () => {
|
describe('POST /api/organizations', () => {
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res = await axios.post(base + '/api/organisations', {
|
const res = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
expect(res.status).toEqual(200);
|
expect(res.status).toEqual(200);
|
||||||
expect(res.headers['content-type']).toContain("application/json")
|
expect(res.headers['content-type']).toContain("application/json")
|
||||||
});
|
});
|
||||||
it('creating a new org with without a name should return 400', async () => {
|
it('creating a new org with without a name should return 400', async () => {
|
||||||
const res = await axios.post(base + '/api/organisations', {
|
const res = await axios.post(base + '/api/organizations', {
|
||||||
"name": null
|
"name": null
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
expect(res.status).toEqual(400);
|
expect(res.status).toEqual(400);
|
||||||
@ -41,14 +41,14 @@ describe('POST /api/organisations', () => {
|
|||||||
// ---------------
|
// ---------------
|
||||||
describe('adding + getting from all orgs', () => {
|
describe('adding + getting from all orgs', () => {
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res = await axios.post(base + '/api/organisations', {
|
const res = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
expect(res.status).toEqual(200);
|
expect(res.status).toEqual(200);
|
||||||
expect(res.headers['content-type']).toContain("application/json")
|
expect(res.headers['content-type']).toContain("application/json")
|
||||||
});
|
});
|
||||||
it('check if org was added', async () => {
|
it('check if org was added', async () => {
|
||||||
const res = await axios.get(base + '/api/organisations', axios_config);
|
const res = await axios.get(base + '/api/organizations', axios_config);
|
||||||
expect(res.status).toEqual(200);
|
expect(res.status).toEqual(200);
|
||||||
expect(res.headers['content-type']).toContain("application/json")
|
expect(res.headers['content-type']).toContain("application/json")
|
||||||
let added_org = res.data[res.data.length - 1]
|
let added_org = res.data[res.data.length - 1]
|
||||||
@ -72,7 +72,7 @@ describe('adding + getting from all orgs', () => {
|
|||||||
describe('adding + getting explicitly', () => {
|
describe('adding + getting explicitly', () => {
|
||||||
let added_org_id
|
let added_org_id
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res1 = await axios.post(base + '/api/organisations', {
|
const res1 = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
let added_org = res1.data
|
let added_org = res1.data
|
||||||
@ -81,7 +81,7 @@ describe('adding + getting explicitly', () => {
|
|||||||
expect(res1.headers['content-type']).toContain("application/json")
|
expect(res1.headers['content-type']).toContain("application/json")
|
||||||
});
|
});
|
||||||
it('check if org was added', async () => {
|
it('check if org was added', async () => {
|
||||||
const res2 = await axios.get(base + '/api/organisations/' + added_org_id, axios_config);
|
const res2 = await axios.get(base + '/api/organizations/' + added_org_id, axios_config);
|
||||||
expect(res2.status).toEqual(200);
|
expect(res2.status).toEqual(200);
|
||||||
expect(res2.headers['content-type']).toContain("application/json")
|
expect(res2.headers['content-type']).toContain("application/json")
|
||||||
let added_org2 = res2.data
|
let added_org2 = res2.data
|
||||||
|
@ -17,7 +17,7 @@ beforeAll(async () => {
|
|||||||
// ---------------
|
// ---------------
|
||||||
describe('adding + deletion (non-existant)', () => {
|
describe('adding + deletion (non-existant)', () => {
|
||||||
it('delete', async () => {
|
it('delete', async () => {
|
||||||
const res2 = await axios.delete(base + '/api/organisations/0', axios_config);
|
const res2 = await axios.delete(base + '/api/organizations/0', axios_config);
|
||||||
expect(res2.status).toEqual(204);
|
expect(res2.status).toEqual(204);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -26,7 +26,7 @@ describe('adding + deletion (successfull)', () => {
|
|||||||
let added_org_id
|
let added_org_id
|
||||||
let added_org
|
let added_org
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res1 = await axios.post(base + '/api/organisations', {
|
const res1 = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res1.data
|
added_org = res1.data
|
||||||
@ -35,7 +35,7 @@ describe('adding + deletion (successfull)', () => {
|
|||||||
expect(res1.headers['content-type']).toContain("application/json")
|
expect(res1.headers['content-type']).toContain("application/json")
|
||||||
});
|
});
|
||||||
it('delete', async () => {
|
it('delete', async () => {
|
||||||
const res2 = await axios.delete(base + '/api/organisations/' + added_org_id, axios_config);
|
const res2 = await axios.delete(base + '/api/organizations/' + added_org_id, axios_config);
|
||||||
expect(res2.status).toEqual(200);
|
expect(res2.status).toEqual(200);
|
||||||
expect(res2.headers['content-type']).toContain("application/json")
|
expect(res2.headers['content-type']).toContain("application/json")
|
||||||
let added_org2 = res2.data
|
let added_org2 = res2.data
|
||||||
@ -56,7 +56,7 @@ describe('adding + deletion (successfull)', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('check if org really was deleted', async () => {
|
it('check if org really was deleted', async () => {
|
||||||
const res3 = await axios.get(base + '/api/organisations/' + added_org_id, axios_config);
|
const res3 = await axios.get(base + '/api/organizations/' + added_org_id, axios_config);
|
||||||
expect(res3.status).toEqual(404);
|
expect(res3.status).toEqual(404);
|
||||||
expect(res3.headers['content-type']).toContain("application/json")
|
expect(res3.headers['content-type']).toContain("application/json")
|
||||||
});
|
});
|
||||||
@ -68,7 +68,7 @@ describe('adding + deletion with teams still existing (without force)', () => {
|
|||||||
let added_team;
|
let added_team;
|
||||||
let added_team_id
|
let added_team_id
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res1 = await axios.post(base + '/api/organisations', {
|
const res1 = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res1.data;
|
added_org = res1.data;
|
||||||
@ -87,7 +87,7 @@ describe('adding + deletion with teams still existing (without force)', () => {
|
|||||||
expect(res2.headers['content-type']).toContain("application/json")
|
expect(res2.headers['content-type']).toContain("application/json")
|
||||||
});
|
});
|
||||||
it('delete org - this should fail with a 406', async () => {
|
it('delete org - this should fail with a 406', async () => {
|
||||||
const res2 = await axios.delete(base + '/api/organisations/' + added_org_id, axios_config);
|
const res2 = await axios.delete(base + '/api/organizations/' + added_org_id, axios_config);
|
||||||
expect(res2.status).toEqual(406);
|
expect(res2.status).toEqual(406);
|
||||||
expect(res2.headers['content-type']).toContain("application/json")
|
expect(res2.headers['content-type']).toContain("application/json")
|
||||||
});
|
});
|
||||||
@ -99,7 +99,7 @@ describe('adding + deletion with teams still existing (with force)', () => {
|
|||||||
let added_team;
|
let added_team;
|
||||||
let added_team_id
|
let added_team_id
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res1 = await axios.post(base + '/api/organisations', {
|
const res1 = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res1.data;
|
added_org = res1.data;
|
||||||
@ -118,7 +118,7 @@ describe('adding + deletion with teams still existing (with force)', () => {
|
|||||||
expect(res2.headers['content-type']).toContain("application/json")
|
expect(res2.headers['content-type']).toContain("application/json")
|
||||||
});
|
});
|
||||||
it('delete', async () => {
|
it('delete', async () => {
|
||||||
const res2 = await axios.delete(base + '/api/organisations/' + added_org_id + '?force=true', axios_config);
|
const res2 = await axios.delete(base + '/api/organizations/' + added_org_id + '?force=true', axios_config);
|
||||||
expect(res2.status).toEqual(200);
|
expect(res2.status).toEqual(200);
|
||||||
expect(res2.headers['content-type']).toContain("application/json")
|
expect(res2.headers['content-type']).toContain("application/json")
|
||||||
let added_org2 = res2.data
|
let added_org2 = res2.data
|
||||||
@ -139,7 +139,7 @@ describe('adding + deletion with teams still existing (with force)', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('check if org really was deleted', async () => {
|
it('check if org really was deleted', async () => {
|
||||||
const res3 = await axios.get(base + '/api/organisations/' + added_org_id, axios_config);
|
const res3 = await axios.get(base + '/api/organizations/' + added_org_id, axios_config);
|
||||||
expect(res3.status).toEqual(404);
|
expect(res3.status).toEqual(404);
|
||||||
expect(res3.headers['content-type']).toContain("application/json")
|
expect(res3.headers['content-type']).toContain("application/json")
|
||||||
});
|
});
|
||||||
|
@ -14,15 +14,15 @@ beforeAll(async () => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('GET /api/organisations', () => {
|
describe('GET /api/organizations', () => {
|
||||||
it('basic get should return 200', async () => {
|
it('basic get should return 200', async () => {
|
||||||
const res = await axios.get(base + '/api/organisations', axios_config);
|
const res = await axios.get(base + '/api/organizations', axios_config);
|
||||||
expect(res.status).toEqual(200);
|
expect(res.status).toEqual(200);
|
||||||
expect(res.headers['content-type']).toContain("application/json")
|
expect(res.headers['content-type']).toContain("application/json")
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
// ---------------
|
// ---------------
|
||||||
describe('GET /api/organisations/0', () => {
|
describe('GET /api/organizations/0', () => {
|
||||||
it('basic get should return 404', async () => {
|
it('basic get should return 404', async () => {
|
||||||
const res = await axios.get(base + '/api/runners/0', axios_config);
|
const res = await axios.get(base + '/api/runners/0', axios_config);
|
||||||
expect(res.status).toEqual(404);
|
expect(res.status).toEqual(404);
|
||||||
|
@ -19,7 +19,7 @@ describe('adding + updating name', () => {
|
|||||||
let added_org_id
|
let added_org_id
|
||||||
let added_org
|
let added_org
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res = await axios.post(base + '/api/organisations', {
|
const res = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res.data
|
added_org = res.data
|
||||||
@ -28,7 +28,7 @@ describe('adding + updating name', () => {
|
|||||||
expect(res.headers['content-type']).toContain("application/json")
|
expect(res.headers['content-type']).toContain("application/json")
|
||||||
});
|
});
|
||||||
it('update org', async () => {
|
it('update org', async () => {
|
||||||
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
|
const res = await axios.put(base + '/api/organizations/' + added_org_id, {
|
||||||
"id": added_org_id,
|
"id": added_org_id,
|
||||||
"name": "testlelele",
|
"name": "testlelele",
|
||||||
"contact": null,
|
"contact": null,
|
||||||
@ -59,7 +59,7 @@ describe('adding + try updating id (should return 406)', () => {
|
|||||||
let added_org_id
|
let added_org_id
|
||||||
let added_org
|
let added_org
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res = await axios.post(base + '/api/organisations', {
|
const res = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res.data
|
added_org = res.data
|
||||||
@ -68,7 +68,7 @@ describe('adding + try updating id (should return 406)', () => {
|
|||||||
expect(res.headers['content-type']).toContain("application/json")
|
expect(res.headers['content-type']).toContain("application/json")
|
||||||
});
|
});
|
||||||
it('update org', async () => {
|
it('update org', async () => {
|
||||||
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
|
const res = await axios.put(base + '/api/organizations/' + added_org_id, {
|
||||||
"id": added_org_id + 1,
|
"id": added_org_id + 1,
|
||||||
"name": "testlelele",
|
"name": "testlelele",
|
||||||
"contact": null,
|
"contact": null,
|
||||||
@ -83,7 +83,7 @@ describe('adding + updateing address valid)', () => {
|
|||||||
let added_org_id
|
let added_org_id
|
||||||
let added_org
|
let added_org
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res = await axios.post(base + '/api/organisations', {
|
const res = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res.data
|
added_org = res.data
|
||||||
@ -92,7 +92,7 @@ describe('adding + updateing address valid)', () => {
|
|||||||
expect(res.headers['content-type']).toContain("application/json")
|
expect(res.headers['content-type']).toContain("application/json")
|
||||||
});
|
});
|
||||||
it('adding address to org should return 200', async () => {
|
it('adding address to org should return 200', async () => {
|
||||||
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
|
const res = await axios.put(base + '/api/organizations/' + added_org_id, {
|
||||||
"id": added_org_id,
|
"id": added_org_id,
|
||||||
"name": "testlelele",
|
"name": "testlelele",
|
||||||
"contact": null,
|
"contact": null,
|
||||||
@ -122,7 +122,7 @@ describe('adding + updateing address valid)', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('updateing address\'s first line should return 200', async () => {
|
it('updateing address\'s first line should return 200', async () => {
|
||||||
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
|
const res = await axios.put(base + '/api/organizations/' + added_org_id, {
|
||||||
"id": added_org_id,
|
"id": added_org_id,
|
||||||
"name": "testlelele",
|
"name": "testlelele",
|
||||||
"contact": null,
|
"contact": null,
|
||||||
@ -152,7 +152,7 @@ describe('adding + updateing address valid)', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('updateing address\'s second line should return 200', async () => {
|
it('updateing address\'s second line should return 200', async () => {
|
||||||
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
|
const res = await axios.put(base + '/api/organizations/' + added_org_id, {
|
||||||
"id": added_org_id,
|
"id": added_org_id,
|
||||||
"name": "testlelele",
|
"name": "testlelele",
|
||||||
"contact": null,
|
"contact": null,
|
||||||
@ -182,7 +182,7 @@ describe('adding + updateing address valid)', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('updateing address\'s city should return 200', async () => {
|
it('updateing address\'s city should return 200', async () => {
|
||||||
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
|
const res = await axios.put(base + '/api/organizations/' + added_org_id, {
|
||||||
"id": added_org_id,
|
"id": added_org_id,
|
||||||
"name": "testlelele",
|
"name": "testlelele",
|
||||||
"contact": null,
|
"contact": null,
|
||||||
@ -212,7 +212,7 @@ describe('adding + updateing address valid)', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('updateing address\'s country should return 200', async () => {
|
it('updateing address\'s country should return 200', async () => {
|
||||||
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
|
const res = await axios.put(base + '/api/organizations/' + added_org_id, {
|
||||||
"id": added_org_id,
|
"id": added_org_id,
|
||||||
"name": "testlelele",
|
"name": "testlelele",
|
||||||
"contact": null,
|
"contact": null,
|
||||||
@ -242,7 +242,7 @@ describe('adding + updateing address valid)', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('updateing address\'s postal code should return 200', async () => {
|
it('updateing address\'s postal code should return 200', async () => {
|
||||||
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
|
const res = await axios.put(base + '/api/organizations/' + added_org_id, {
|
||||||
"id": added_org_id,
|
"id": added_org_id,
|
||||||
"name": "testlelele",
|
"name": "testlelele",
|
||||||
"contact": null,
|
"contact": null,
|
||||||
@ -272,7 +272,7 @@ describe('adding + updateing address valid)', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('removing org\'s address should return 200', async () => {
|
it('removing org\'s address should return 200', async () => {
|
||||||
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
|
const res = await axios.put(base + '/api/organizations/' + added_org_id, {
|
||||||
"id": added_org_id,
|
"id": added_org_id,
|
||||||
"name": "testlelele",
|
"name": "testlelele",
|
||||||
"contact": null,
|
"contact": null,
|
||||||
@ -300,7 +300,7 @@ describe('adding + updateing address invalid)', () => {
|
|||||||
let added_org_id
|
let added_org_id
|
||||||
let added_org
|
let added_org
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res = await axios.post(base + '/api/organisations', {
|
const res = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res.data
|
added_org = res.data
|
||||||
@ -309,7 +309,7 @@ describe('adding + updateing address invalid)', () => {
|
|||||||
expect(res.headers['content-type']).toContain("application/json")
|
expect(res.headers['content-type']).toContain("application/json")
|
||||||
});
|
});
|
||||||
it('adding address to org w/o address1 should return 400', async () => {
|
it('adding address to org w/o address1 should return 400', async () => {
|
||||||
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
|
const res = await axios.put(base + '/api/organizations/' + added_org_id, {
|
||||||
"id": added_org_id,
|
"id": added_org_id,
|
||||||
"name": "testlelele",
|
"name": "testlelele",
|
||||||
"contact": null,
|
"contact": null,
|
||||||
@ -325,7 +325,7 @@ describe('adding + updateing address invalid)', () => {
|
|||||||
expect(res.headers['content-type']).toContain("application/json");
|
expect(res.headers['content-type']).toContain("application/json");
|
||||||
});
|
});
|
||||||
it('adding address to org w/o city should return 400', async () => {
|
it('adding address to org w/o city should return 400', async () => {
|
||||||
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
|
const res = await axios.put(base + '/api/organizations/' + added_org_id, {
|
||||||
"id": added_org_id,
|
"id": added_org_id,
|
||||||
"name": "testlelele",
|
"name": "testlelele",
|
||||||
"contact": null,
|
"contact": null,
|
||||||
@ -341,7 +341,7 @@ describe('adding + updateing address invalid)', () => {
|
|||||||
expect(res.headers['content-type']).toContain("application/json");
|
expect(res.headers['content-type']).toContain("application/json");
|
||||||
});
|
});
|
||||||
it('adding address to org w/o country should return 400', async () => {
|
it('adding address to org w/o country should return 400', async () => {
|
||||||
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
|
const res = await axios.put(base + '/api/organizations/' + added_org_id, {
|
||||||
"id": added_org_id,
|
"id": added_org_id,
|
||||||
"name": "testlelele",
|
"name": "testlelele",
|
||||||
"contact": null,
|
"contact": null,
|
||||||
@ -357,7 +357,7 @@ describe('adding + updateing address invalid)', () => {
|
|||||||
expect(res.headers['content-type']).toContain("application/json");
|
expect(res.headers['content-type']).toContain("application/json");
|
||||||
});
|
});
|
||||||
it('adding address to org w/o postal code should return 400', async () => {
|
it('adding address to org w/o postal code should return 400', async () => {
|
||||||
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
|
const res = await axios.put(base + '/api/organizations/' + added_org_id, {
|
||||||
"id": added_org_id,
|
"id": added_org_id,
|
||||||
"name": "testlelele",
|
"name": "testlelele",
|
||||||
"contact": null,
|
"contact": null,
|
||||||
@ -373,7 +373,7 @@ describe('adding + updateing address invalid)', () => {
|
|||||||
expect(res.headers['content-type']).toContain("application/json");
|
expect(res.headers['content-type']).toContain("application/json");
|
||||||
});
|
});
|
||||||
it('adding address to org w/ invalid postal code should return 400', async () => {
|
it('adding address to org w/ invalid postal code should return 400', async () => {
|
||||||
const res = await axios.put(base + '/api/organisations/' + added_org_id, {
|
const res = await axios.put(base + '/api/organizations/' + added_org_id, {
|
||||||
"id": added_org_id,
|
"id": added_org_id,
|
||||||
"name": "testlelele",
|
"name": "testlelele",
|
||||||
"contact": null,
|
"contact": null,
|
||||||
|
@ -58,7 +58,7 @@ describe('POST /api/teams with errors', () => {
|
|||||||
describe('POST /api/teams working', () => {
|
describe('POST /api/teams working', () => {
|
||||||
let added_org_id;
|
let added_org_id;
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res1 = await axios.post(base + '/api/organisations', {
|
const res1 = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
let added_org = res1.data
|
let added_org = res1.data
|
||||||
|
@ -21,7 +21,7 @@ describe('adding org', () => {
|
|||||||
let added_team;
|
let added_team;
|
||||||
let added_team_id
|
let added_team_id
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res1 = await axios.post(base + '/api/organisations', {
|
const res1 = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res1.data;
|
added_org = res1.data;
|
||||||
|
@ -20,7 +20,7 @@ describe('adding + updating name', () => {
|
|||||||
let added_team;
|
let added_team;
|
||||||
let added_team_id
|
let added_team_id
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res1 = await axios.post(base + '/api/organisations', {
|
const res1 = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res1.data;
|
added_org = res1.data;
|
||||||
@ -59,7 +59,7 @@ describe('adding + try updating id (should return 406)', () => {
|
|||||||
let added_team;
|
let added_team;
|
||||||
let added_team_id
|
let added_team_id
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res1 = await axios.post(base + '/api/organisations', {
|
const res1 = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res1.data;
|
added_org = res1.data;
|
||||||
@ -92,7 +92,7 @@ describe('add+update parent org (valid)', () => {
|
|||||||
let added_team;
|
let added_team;
|
||||||
let added_team_id
|
let added_team_id
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res1 = await axios.post(base + '/api/organisations', {
|
const res1 = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res1.data;
|
added_org = res1.data;
|
||||||
@ -110,7 +110,7 @@ describe('add+update parent org (valid)', () => {
|
|||||||
expect(res2.headers['content-type']).toContain("application/json")
|
expect(res2.headers['content-type']).toContain("application/json")
|
||||||
});
|
});
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res3 = await axios.post(base + '/api/organisations', {
|
const res3 = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org2 = res3.data;
|
added_org2 = res3.data;
|
||||||
|
@ -80,7 +80,7 @@ describe('POST /api/runners with errors', () => {
|
|||||||
describe('POST /api/runners working', () => {
|
describe('POST /api/runners working', () => {
|
||||||
let added_org_id;
|
let added_org_id;
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res1 = await axios.post(base + '/api/organisations', {
|
const res1 = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
let added_org = res1.data
|
let added_org = res1.data
|
||||||
|
@ -25,7 +25,7 @@ describe('add+delete', () => {
|
|||||||
let added_org_id;
|
let added_org_id;
|
||||||
let added_runner;
|
let added_runner;
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res1 = await axios.post(base + '/api/organisations', {
|
const res1 = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
let added_org = res1.data
|
let added_org = res1.data
|
||||||
@ -71,7 +71,7 @@ describe('DELETE donor with donations invalid', () => {
|
|||||||
expect(res.headers['content-type']).toContain("application/json")
|
expect(res.headers['content-type']).toContain("application/json")
|
||||||
});
|
});
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res = await axios.post(base + '/api/organisations', {
|
const res = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res.data
|
added_org = res.data
|
||||||
@ -118,7 +118,7 @@ describe('DELETE donor with donations valid', () => {
|
|||||||
expect(res.headers['content-type']).toContain("application/json")
|
expect(res.headers['content-type']).toContain("application/json")
|
||||||
});
|
});
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res = await axios.post(base + '/api/organisations', {
|
const res = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res.data
|
added_org = res.data
|
||||||
|
@ -33,7 +33,7 @@ describe('GET /api/runners after adding', () => {
|
|||||||
let added_org_id;
|
let added_org_id;
|
||||||
let added_runner;
|
let added_runner;
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res1 = await axios.post(base + '/api/organisations', {
|
const res1 = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
let added_org = res1.data
|
let added_org = res1.data
|
||||||
|
@ -18,7 +18,7 @@ describe('Update runner name after adding', () => {
|
|||||||
let added_org;
|
let added_org;
|
||||||
let added_runner;
|
let added_runner;
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res1 = await axios.post(base + '/api/organisations', {
|
const res1 = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
delete res1.data.registrationEnabled;
|
delete res1.data.registrationEnabled;
|
||||||
@ -58,7 +58,7 @@ describe('Update runner group after adding', () => {
|
|||||||
let added_org_2;
|
let added_org_2;
|
||||||
let added_runner;
|
let added_runner;
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res1 = await axios.post(base + '/api/organisations', {
|
const res1 = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
let added_org = res1.data
|
let added_org = res1.data
|
||||||
@ -77,7 +77,7 @@ describe('Update runner group after adding', () => {
|
|||||||
expect(res2.headers['content-type']).toContain("application/json")
|
expect(res2.headers['content-type']).toContain("application/json")
|
||||||
});
|
});
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res3 = await axios.post(base + '/api/organisations', {
|
const res3 = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org_2 = res3.data
|
added_org_2 = res3.data
|
||||||
@ -103,7 +103,7 @@ describe('Update runner id after adding(should fail)', () => {
|
|||||||
let added_runner;
|
let added_runner;
|
||||||
let added_runner_id;
|
let added_runner_id;
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res1 = await axios.post(base + '/api/organisations', {
|
const res1 = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
let added_org = res1.data
|
let added_org = res1.data
|
||||||
@ -135,7 +135,7 @@ describe('Update runner group with invalid group after adding', () => {
|
|||||||
let added_org;
|
let added_org;
|
||||||
let added_runner;
|
let added_runner;
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res1 = await axios.post(base + '/api/organisations', {
|
const res1 = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res1.data
|
added_org = res1.data
|
||||||
|
@ -19,7 +19,7 @@ describe('POST /api/scans illegally', () => {
|
|||||||
let added_org;
|
let added_org;
|
||||||
let added_runner;
|
let added_runner;
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res1 = await axios.post(base + '/api/organisations', {
|
const res1 = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res1.data
|
added_org = res1.data
|
||||||
@ -70,7 +70,7 @@ describe('POST /api/scans successfully', () => {
|
|||||||
let added_org;
|
let added_org;
|
||||||
let added_runner;
|
let added_runner;
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res1 = await axios.post(base + '/api/organisations', {
|
const res1 = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res1.data
|
added_org = res1.data
|
||||||
@ -144,7 +144,7 @@ describe('POST /api/scans successfully via scan station', () => {
|
|||||||
let added_track;
|
let added_track;
|
||||||
let added_station;
|
let added_station;
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res1 = await axios.post(base + '/api/organisations', {
|
const res1 = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res1.data
|
added_org = res1.data
|
||||||
|
@ -21,7 +21,7 @@ describe('DELETE scan', () => {
|
|||||||
let added_runner;
|
let added_runner;
|
||||||
let added_scan;
|
let added_scan;
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res1 = await axios.post(base + '/api/organisations', {
|
const res1 = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res1.data
|
added_org = res1.data
|
||||||
|
@ -35,7 +35,7 @@ describe('adding + getting scans', () => {
|
|||||||
let added_runner;
|
let added_runner;
|
||||||
let added_scan;
|
let added_scan;
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res1 = await axios.post(base + '/api/organisations', {
|
const res1 = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res1.data
|
added_org = res1.data
|
||||||
|
@ -19,7 +19,7 @@ describe('adding + updating illegally', () => {
|
|||||||
let added_runner;
|
let added_runner;
|
||||||
let added_scan;
|
let added_scan;
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res1 = await axios.post(base + '/api/organisations', {
|
const res1 = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res1.data
|
added_org = res1.data
|
||||||
@ -86,7 +86,7 @@ describe('adding + updating successfilly', () => {
|
|||||||
let added_runner2;
|
let added_runner2;
|
||||||
let added_scan;
|
let added_scan;
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res1 = await axios.post(base + '/api/organisations', {
|
const res1 = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res1.data
|
added_org = res1.data
|
||||||
|
@ -98,7 +98,7 @@ describe('register citizen valid', () => {
|
|||||||
describe('register invalid company', () => {
|
describe('register invalid company', () => {
|
||||||
let added_org;
|
let added_org;
|
||||||
it('creating a new org with just a name and registration enabled should return 200', async () => {
|
it('creating a new org with just a name and registration enabled should return 200', async () => {
|
||||||
const res = await axios.post(base + '/api/organisations', {
|
const res = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123",
|
"name": "test123",
|
||||||
"registrationEnabled": true
|
"registrationEnabled": true
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
@ -156,7 +156,7 @@ describe('register valid company', () => {
|
|||||||
let added_org;
|
let added_org;
|
||||||
let added_team;
|
let added_team;
|
||||||
it('creating a new org with just a name and registration enabled should return 200', async () => {
|
it('creating a new org with just a name and registration enabled should return 200', async () => {
|
||||||
const res = await axios.post(base + '/api/organisations', {
|
const res = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123",
|
"name": "test123",
|
||||||
"registrationEnabled": true
|
"registrationEnabled": true
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
|
@ -22,7 +22,7 @@ describe('POST /api/scans illegally', () => {
|
|||||||
let added_track;
|
let added_track;
|
||||||
let added_station;
|
let added_station;
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res1 = await axios.post(base + '/api/organisations', {
|
const res1 = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res1.data
|
added_org = res1.data
|
||||||
@ -109,7 +109,7 @@ describe('POST /api/scans successfully', () => {
|
|||||||
let added_track;
|
let added_track;
|
||||||
let added_station;
|
let added_station;
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res1 = await axios.post(base + '/api/organisations', {
|
const res1 = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res1.data
|
added_org = res1.data
|
||||||
@ -179,7 +179,7 @@ describe('POST /api/scans successfully via scan station', () => {
|
|||||||
let added_track;
|
let added_track;
|
||||||
let added_station;
|
let added_station;
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res1 = await axios.post(base + '/api/organisations', {
|
const res1 = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res1.data
|
added_org = res1.data
|
||||||
|
@ -24,7 +24,7 @@ describe('DELETE scan', () => {
|
|||||||
let added_station;
|
let added_station;
|
||||||
let added_scan;
|
let added_scan;
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res1 = await axios.post(base + '/api/organisations', {
|
const res1 = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res1.data
|
added_org = res1.data
|
||||||
|
@ -38,7 +38,7 @@ describe('adding + getting scans', () => {
|
|||||||
let added_station;
|
let added_station;
|
||||||
let added_scan;
|
let added_scan;
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res1 = await axios.post(base + '/api/organisations', {
|
const res1 = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res1.data
|
added_org = res1.data
|
||||||
|
@ -22,7 +22,7 @@ describe('adding + updating illegally', () => {
|
|||||||
let added_station;
|
let added_station;
|
||||||
let added_scan;
|
let added_scan;
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res1 = await axios.post(base + '/api/organisations', {
|
const res1 = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res1.data
|
added_org = res1.data
|
||||||
@ -123,7 +123,7 @@ describe('adding + updating successfilly', () => {
|
|||||||
let added_station2;
|
let added_station2;
|
||||||
let added_scan;
|
let added_scan;
|
||||||
it('creating a new org with just a name should return 200', async () => {
|
it('creating a new org with just a name should return 200', async () => {
|
||||||
const res1 = await axios.post(base + '/api/organisations', {
|
const res1 = await axios.post(base + '/api/organizations', {
|
||||||
"name": "test123"
|
"name": "test123"
|
||||||
}, axios_config);
|
}, axios_config);
|
||||||
added_org = res1.data
|
added_org = res1.data
|
||||||
|
Loading…
x
Reference in New Issue
Block a user