Compare commits

...

10 Commits

Author SHA1 Message Date
Nicolai Ort a3a1395a46 Merge pull request 'Release 0.6.3' (#165) from dev into main
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
Reviewed-on: #165
Reviewed-by: Philipp Dormann <philipp@philippdormann.de>
2021-03-18 15:53:42 +00:00
Nicolai Ort b08acc6660 🧾New changelog file version [CI SKIP] [skip ci]
continuous-integration/drone/pr Build is passing Details
2021-03-18 15:11:01 +00:00
Nicolai Ort 7a303c2b2c 🚀Bumped version to v0.6.3
continuous-integration/drone/push Build is passing Details
2021-03-18 16:10:02 +01:00
Nicolai Ort 3f9a7049e3 🧾New changelog file version [CI SKIP] [skip ci] 2021-03-18 15:09:50 +00:00
Nicolai Ort 6249419fae Merge pull request 'TrackScan Update bug 🐞bugfix/163-trackscan_updates' (#164) from bugfix/163-trackscan_updates into dev
continuous-integration/drone/push Build is failing Details
Reviewed-on: #164
2021-03-18 15:09:08 +00:00
Nicolai Ort f347b7ad49 Updated tests 🧪
continuous-integration/drone/pr Build is passing Details
ref #163
2021-03-18 14:05:13 +01:00
Nicolai Ort 74faec85c8 Merge branch 'bugfix/163-trackscan_updates' of git.odit.services:lfk/backend into bugfix/163-trackscan_updates 2021-03-18 14:00:16 +01:00
Nicolai Ort fbdadbef1f The basic bugfix 🐞
ref #163
2021-03-18 14:00:14 +01:00
Nicolai Ort c87c97c90f The basic bugfix 🐞
REF '!&§
2021-03-18 14:00:04 +01:00
Nicolai Ort a6bca59ffe 🧾New changelog file version [CI SKIP] [skip ci] 2021-03-17 18:44:42 +00:00
4 changed files with 32 additions and 19 deletions

View File

@ -2,12 +2,23 @@
All notable changes to this project will be documented in this file. Dates are displayed in UTC.
#### [v0.6.3](https://git.odit.services/lfk/backend/compare/v0.6.2...v0.6.3)
- The basic bugfix 🐞 [`fbdadbe`](https://git.odit.services/lfk/backend/commit/fbdadbef1f9eb835e1914e8d3770cca836b4c443)
- The basic bugfix 🐞 [`c87c97c`](https://git.odit.services/lfk/backend/commit/c87c97c90f5e1229f92671b1f2ebe1fa0d2307cd)
- Updated tests 🧪 [`f347b7a`](https://git.odit.services/lfk/backend/commit/f347b7ad4982ed3760117c08e11dca5c3f72d495)
- 🧾New changelog file version [CI SKIP] [skip ci] [`3f9a704`](https://git.odit.services/lfk/backend/commit/3f9a7049e31a6948125a07e847233b804f27ba31)
- 🚀Bumped version to v0.6.3 [`7a303c2`](https://git.odit.services/lfk/backend/commit/7a303c2b2c267d6dd566b1470649e65bc1c1b2ee)
- Merge pull request 'TrackScan Update bug 🐞bugfix/163-trackscan_updates' (#164) from bugfix/163-trackscan_updates into dev [`6249419`](https://git.odit.services/lfk/backend/commit/6249419fae22e0203c046c1a3cd82c07f94f510c)
- 🧾New changelog file version [CI SKIP] [skip ci] [`a6bca59`](https://git.odit.services/lfk/backend/commit/a6bca59ffe06a37f03af21500c442cebeaa74c7e)
#### [v0.6.2](https://git.odit.services/lfk/backend/compare/v0.6.1...v0.6.2)
> 17 March 2021
- Merge pull request 'Release 0.6.2' (#162) from dev into main [`732a1b8`](https://git.odit.services/lfk/backend/commit/732a1b88d916720ea82cd4b192fc696640ade2aa)
- 🧾New changelog file version [CI SKIP] [skip ci] [`fcb43f9`](https://git.odit.services/lfk/backend/commit/fcb43f92b0b7a8fa2ed3772357c3eab8e6564eef)
- Fixed trackscan vaildation [`a8ea4fa`](https://git.odit.services/lfk/backend/commit/a8ea4fa659732ca2c922fc3c75d2238be2feb5c7)
- 🚀Bumped version to v0.6.2 [`5ba8f1d`](https://git.odit.services/lfk/backend/commit/5ba8f1dd4451c1a1b38fdd36cf632c9e6efa829c)
- Merge pull request 'Bugfixes for trackscans feature/160-responseTrackScan_total_distance' (#161) from feature/160-responseTrackScan_total_distance into dev [`3d3790c`](https://git.odit.services/lfk/backend/commit/3d3790c2eb6a92bb5b1d2c7e44c75aef4e1b015f)
- Added comments✏ [`289f9e2`](https://git.odit.services/lfk/backend/commit/289f9e219692789f86c631f52c67b578216acb48)
- Added comments✏ [`937a9fa`](https://git.odit.services/lfk/backend/commit/937a9fad4d8914b83fc6300f776c0720b756a9f4)
- Removed duplicate openapi declarations 🗑 [`c8882ae`](https://git.odit.services/lfk/backend/commit/c8882ae6a18188a9c98a237dd594548ebac6f460)
@ -15,8 +26,11 @@ All notable changes to this project will be documented in this file. Dates are d
- Changed the method of getting a parameter from the headers🛠 [`1d38d30`](https://git.odit.services/lfk/backend/commit/1d38d308ad8ae00d67c2b807b584da4f00bd9a58)
- Now auto-etting the station token🔥🔥🔥 [`aae042c`](https://git.odit.services/lfk/backend/commit/aae042c041e325626b89b146d005e900bd880453)
- Marked station as optional (quality of life improvements incoming) [`1f32ed0`](https://git.odit.services/lfk/backend/commit/1f32ed0727cb1117e5d201b5530b2f2d7f0323d8)
- 🧾New changelog file version [CI SKIP] [skip ci] [`4c960fe`](https://git.odit.services/lfk/backend/commit/4c960feeb22f819d1c618ced73f5799a3c7e4f00)
- Fixed missing renameing🛠 [`0ed7f78`](https://git.odit.services/lfk/backend/commit/0ed7f78b2c284909d47fa0533424c279adef0ba3)
- 🧾New changelog file version [CI SKIP] [skip ci] [`c1dd451`](https://git.odit.services/lfk/backend/commit/c1dd4518d128edd8b8e36981a513744471241a25)
- 🚀Bumped version to v0.6.2 [`5ba8f1d`](https://git.odit.services/lfk/backend/commit/5ba8f1dd4451c1a1b38fdd36cf632c9e6efa829c)
- Merge pull request 'Bugfixes for trackscans feature/160-responseTrackScan_total_distance' (#161) from feature/160-responseTrackScan_total_distance into dev [`3d3790c`](https://git.odit.services/lfk/backend/commit/3d3790c2eb6a92bb5b1d2c7e44c75aef4e1b015f)
- Fixed wrong error type 👀👀 [`1fa3fa7`](https://git.odit.services/lfk/backend/commit/1fa3fa75ee447b9919585e02c7997e3f1de9c8a7)
- Added missing discription [`673e896`](https://git.odit.services/lfk/backend/commit/673e896aa3dc853b301a2e560e785c464a449b6f)

View File

@ -1,6 +1,6 @@
{
"name": "@odit/lfk-backend",
"version": "0.6.2",
"version": "0.6.3",
"main": "src/app.ts",
"repository": "https://git.odit.services/lfk/backend",
"author": {

View File

@ -1,9 +1,9 @@
import { IsBoolean, IsInt, IsOptional, IsPositive } from 'class-validator';
import { getConnection } from 'typeorm';
import { RunnerNotFoundError } from '../../../errors/RunnerErrors';
import { ScanStationNotFoundError } from '../../../errors/ScanStationErrors';
import { TrackNotFoundError } from '../../../errors/TrackErrors';
import { Runner } from '../../entities/Runner';
import { ScanStation } from '../../entities/ScanStation';
import { Track } from '../../entities/Track';
import { TrackScan } from '../../entities/TrackScan';
/**
@ -38,7 +38,7 @@ export abstract class UpdateTrackScan {
*/
@IsInt()
@IsPositive()
public station: number;
public track: number;
/**
* Update a TrackScan entity based on this.
@ -47,8 +47,7 @@ export abstract class UpdateTrackScan {
public async update(scan: TrackScan): Promise<TrackScan> {
scan.valid = this.valid;
scan.runner = await this.getRunner();
scan.station = await this.getStation();
scan.track = scan.station.track;
scan.track = await this.getTrack();
return scan;
}
@ -67,11 +66,11 @@ 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 }, { relations: ['track'] });
if (!station) {
throw new ScanStationNotFoundError();
public async getTrack(): Promise<Track> {
const track = await getConnection().getRepository(Track).findOne({ id: this.track });
if (!track) {
throw new TrackNotFoundError();
}
return station;
return track;
}
}

View File

@ -86,7 +86,7 @@ describe('adding + updating illegally', () => {
it('updating with wrong id should return 406', async () => {
const res2 = await axios.put(base + '/api/scans/trackscans/' + added_scan.id, {
"id": added_scan.id + 1,
"station": added_station.id,
"track": added_track.id,
"runner": added_runner.id
}, axios_config);
expect(res2.status).toEqual(406);
@ -95,7 +95,7 @@ describe('adding + updating illegally', () => {
it('updating with invalid station should return 404', async () => {
const res2 = await axios.put(base + '/api/scans/trackscans/' + added_scan.id, {
"id": added_scan.id,
"station": 9999999999999999,
"track": 9999999999999999,
"runner": added_runner.id
}, axios_config);
expect(res2.status).toEqual(404);
@ -104,7 +104,7 @@ describe('adding + updating illegally', () => {
it('updating with invalid runner should return 404', async () => {
const res2 = await axios.put(base + '/api/scans/trackscans/' + added_scan.id, {
"id": added_scan.id,
"station": added_station.id,
"track": added_station.id,
"runner": 9999999999999999999
}, axios_config);
expect(res2.status).toEqual(404);
@ -211,7 +211,7 @@ describe('adding + updating successfilly', () => {
it('updating with new runner should return 200', async () => {
const res2 = await axios.put(base + '/api/scans/trackscans/' + added_scan.id, {
"id": added_scan.id,
"station": added_station.id,
"track": added_track.id,
"runner": added_runner2.id
}, axios_config);
expect(res2.status).toEqual(200);
@ -220,7 +220,7 @@ describe('adding + updating successfilly', () => {
it('updating with new station should return 200', async () => {
const res2 = await axios.put(base + '/api/scans/trackscans/' + added_scan.id, {
"id": added_scan.id,
"station": added_station2.id,
"track": added_track2.id,
"runner": added_runner.id
}, axios_config);
expect(res2.status).toEqual(200);
@ -229,7 +229,7 @@ describe('adding + updating successfilly', () => {
it('updating with valid=false should return 200', async () => {
const res2 = await axios.put(base + '/api/scans/trackscans/' + added_scan.id, {
"id": added_scan.id,
"station": added_station2.id,
"track": added_track2.id,
"runner": added_runner.id,
"valid": false
}, axios_config);