Compare commits
4 Commits
3b3e68900b
...
cc89ba8afb
Author | SHA1 | Date | |
---|---|---|---|
cc89ba8afb | |||
7c4ff42a3b | |||
8007117434 | |||
23fa78eb9d |
@ -2,8 +2,17 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file. Dates are displayed in UTC.
|
All notable changes to this project will be documented in this file. Dates are displayed in UTC.
|
||||||
|
|
||||||
|
#### [v0.15.0](https://git.odit.services/lfk/backend/compare/v0.14.6...v0.15.0)
|
||||||
|
|
||||||
|
- Added test script for creating mass scans [`8007117`](https://git.odit.services/lfk/backend/commit/80071174342d87199fcbd981cd8c92300b0a51e4)
|
||||||
|
- Get all scans speed improvement [`23fa78e`](https://git.odit.services/lfk/backend/commit/23fa78eb9dcc01ecc036347f6703aacc0d163d7d)
|
||||||
|
- More scan request optimizations [`7c4ff42`](https://git.odit.services/lfk/backend/commit/7c4ff42a3b3e7b186e16c85a97d9ecc854a32cb0)
|
||||||
|
|
||||||
#### [v0.14.6](https://git.odit.services/lfk/backend/compare/v0.14.5...v0.14.6)
|
#### [v0.14.6](https://git.odit.services/lfk/backend/compare/v0.14.5...v0.14.6)
|
||||||
|
|
||||||
|
> 15 April 2023
|
||||||
|
|
||||||
|
- 🚀Bumped version to v0.14.6 [`3b3e689`](https://git.odit.services/lfk/backend/commit/3b3e68900beca16cfff88dbef22540f77750d29b)
|
||||||
- Missing orm file [`3ff666f`](https://git.odit.services/lfk/backend/commit/3ff666fd3e84ac8cf41b30e9e17082b10548d55b)
|
- Missing orm file [`3ff666f`](https://git.odit.services/lfk/backend/commit/3ff666fd3e84ac8cf41b30e9e17082b10548d55b)
|
||||||
|
|
||||||
#### [v0.14.5](https://git.odit.services/lfk/backend/compare/v0.14.4...v0.14.5)
|
#### [v0.14.5](https://git.odit.services/lfk/backend/compare/v0.14.4...v0.14.5)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@odit/lfk-backend",
|
"name": "@odit/lfk-backend",
|
||||||
"version": "0.14.6",
|
"version": "0.15.0",
|
||||||
"main": "src/app.ts",
|
"main": "src/app.ts",
|
||||||
"repository": "https://git.odit.services/lfk/backend",
|
"repository": "https://git.odit.services/lfk/backend",
|
||||||
"engines": {
|
"engines": {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { Request } from "express";
|
import { Request } from "express";
|
||||||
import { Authorized, Body, Delete, Get, JsonController, OnUndefined, Param, Post, Put, QueryParam, Req, UseBefore } from 'routing-controllers';
|
import { Authorized, Body, Delete, Get, JsonController, OnUndefined, Param, Post, Put, QueryParam, Req, UseBefore } from 'routing-controllers';
|
||||||
import { OpenAPI, ResponseSchema } from 'routing-controllers-openapi';
|
import { OpenAPI, ResponseSchema } from 'routing-controllers-openapi';
|
||||||
import { getConnectionManager, Repository } from 'typeorm';
|
import { Repository, getConnectionManager } from 'typeorm';
|
||||||
import { RunnerNotFoundError } from '../errors/RunnerErrors';
|
import { RunnerNotFoundError } from '../errors/RunnerErrors';
|
||||||
import { ScanIdsNotMatchingError, ScanNotFoundError } from '../errors/ScanErrors';
|
import { ScanIdsNotMatchingError, ScanNotFoundError } from '../errors/ScanErrors';
|
||||||
import { ScanStationNotFoundError } from '../errors/ScanStationErrors';
|
import { ScanStationNotFoundError } from '../errors/ScanStationErrors';
|
||||||
@ -36,7 +36,7 @@ export class ScanController {
|
|||||||
@OpenAPI({ description: 'Lists all scans (normal or track) from all runners. <br> This includes the scan\'s runner\'s distance ran.' })
|
@OpenAPI({ description: 'Lists all scans (normal or track) from all runners. <br> This includes the scan\'s runner\'s distance ran.' })
|
||||||
async getAll() {
|
async getAll() {
|
||||||
let responseScans: ResponseScan[] = new Array<ResponseScan>();
|
let responseScans: ResponseScan[] = new Array<ResponseScan>();
|
||||||
const scans = await this.scanRepository.find({ relations: ['runner', 'track', 'runner.scans', 'runner.group', 'runner.scans.track', 'card', 'station'] });
|
const scans = await this.scanRepository.find({ relations: ['runner', 'track'] });
|
||||||
scans.forEach(scan => {
|
scans.forEach(scan => {
|
||||||
responseScans.push(scan.toResponse());
|
responseScans.push(scan.toResponse());
|
||||||
});
|
});
|
||||||
@ -51,7 +51,7 @@ export class ScanController {
|
|||||||
@OnUndefined(ScanNotFoundError)
|
@OnUndefined(ScanNotFoundError)
|
||||||
@OpenAPI({ description: 'Lists all information about the scan whose id got provided. This includes the scan\'s runner\'s distance ran.' })
|
@OpenAPI({ description: 'Lists all information about the scan whose id got provided. This includes the scan\'s runner\'s distance ran.' })
|
||||||
async getOne(@Param('id') id: number) {
|
async getOne(@Param('id') id: number) {
|
||||||
let scan = await this.scanRepository.findOne({ id: id }, { relations: ['runner', 'track', 'runner.scans', 'runner.group', 'runner.scans.track', 'card', 'station'] })
|
let scan = await this.scanRepository.findOne({ id: id }, { relations: ['runner', 'track', 'runner.group', 'card', 'station'] })
|
||||||
if (!scan) { throw new ScanNotFoundError(); }
|
if (!scan) { throw new ScanNotFoundError(); }
|
||||||
return scan.toResponse();
|
return scan.toResponse();
|
||||||
}
|
}
|
||||||
|
17
src/tests/create_mass_scans.ts
Normal file
17
src/tests/create_mass_scans.ts
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
for (let i = 0; i < 100; i++) {
|
||||||
|
const batch = [];
|
||||||
|
for (let i = 0; i < 20; i++) {
|
||||||
|
batch.push(axios.post('http://localhost:4010/api/scans/trackscans', { card: 200000000001, station: 2 }, {
|
||||||
|
headers: {
|
||||||
|
Authorization: 'Bearer 10F2E64.BB4F6CC5-2148-4CCF-88B5-0AA85D0508A9'
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
await Promise.all(batch)
|
||||||
|
console.log(`Finished batch ${i}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
main();
|
Loading…
x
Reference in New Issue
Block a user