diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5a00cd4..333c29a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,8 +2,21 @@
All notable changes to this project will be documented in this file. Dates are displayed in UTC.
+#### [v0.7.0](https://git.odit.services/lfk/backend/compare/v0.6.4...v0.7.0)
+
+- Added bulk card creation tests [`438ff0f`](https://git.odit.services/lfk/backend/commit/438ff0fc3f246f83b1fa04cb11828f4a61dfcd1e)
+- Added new "bulk" endpoint [`c1bbda5`](https://git.odit.services/lfk/backend/commit/c1bbda51f067cbd9ac1a9a5378ae3f5d7b9f4eca)
+- 🧾New changelog file version [CI SKIP] [skip ci] [`7a49e7c`](https://git.odit.services/lfk/backend/commit/7a49e7c5c98eb23af1cd0d2084914641e9a1bf90)
+- 🚀Bumped version to v0.7.0 [`d0ae50d`](https://git.odit.services/lfk/backend/commit/d0ae50d5579e969ad33d6b9cfd66dac7fa472223)
+- Merge pull request 'Bulk card creation feature/168-runnercards_bulk' (#169) from feature/168-runnercards_bulk into dev [`1dd6420`](https://git.odit.services/lfk/backend/commit/1dd64204cc63fb1a8a4a4aa503c21da42945eafd)
+- 🧾New changelog file version [CI SKIP] [skip ci] [`4705a39`](https://git.odit.services/lfk/backend/commit/4705a39aabaad894d332a5062df03840c23c6bfa)
+
#### [v0.6.4](https://git.odit.services/lfk/backend/compare/v0.6.3...v0.6.4)
+> 19 March 2021
+
+- Merge pull request 'Release 0.6.4' (#167) from dev into main [`4d721f6`](https://git.odit.services/lfk/backend/commit/4d721f62d9a5f6a1361ef2811a3a2ff63011b2ad)
+- 🧾New changelog file version [CI SKIP] [skip ci] [`b0328ff`](https://git.odit.services/lfk/backend/commit/b0328ffdaffc8ef2e6e01e808c29748f58f42cac)
- 🧾New changelog file version [CI SKIP] [skip ci] [`cc6568c`](https://git.odit.services/lfk/backend/commit/cc6568c3810fed3ff2597df0db73a6ca9e072413)
- 🚀Bumped version to v0.6.4 [`031cede`](https://git.odit.services/lfk/backend/commit/031cede5426742dc3c2b9dc6b049951d7c14871c)
- Adjsuted endpoint [`3c69f8c`](https://git.odit.services/lfk/backend/commit/3c69f8c4a824e588977b06dbb45119cccb03c6bc)
diff --git a/package.json b/package.json
index 05f69d3..e5b71fe 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@odit/lfk-backend",
- "version": "0.6.4",
+ "version": "0.7.0",
"main": "src/app.ts",
"repository": "https://git.odit.services/lfk/backend",
"author": {
diff --git a/src/controllers/RunnerCardController.ts b/src/controllers/RunnerCardController.ts
index ae74e86..c611ef5 100644
--- a/src/controllers/RunnerCardController.ts
+++ b/src/controllers/RunnerCardController.ts
@@ -47,6 +47,21 @@ export class RunnerCardController {
return card.toResponse();
}
+ @Post('/bulk')
+ @Authorized("CARD:CREATE")
+ @ResponseSchema(ResponseEmpty, { statusCode: 200 })
+ @OpenAPI({ description: "Create blank cards in bulk.
Just provide the count as a query param and wait for the 200 response." })
+ async postBlancoBulk(@QueryParam("count") count: number) {
+ let createPromises = new Array();
+ for (let index = 0; index < count; index++) {
+ createPromises.push(this.cardRepository.save({ runner: null, enabled: true }))
+ }
+ await Promise.all(createPromises);
+ let response = new ResponseEmpty();
+ response.response = `Created ${count} new blanco cards.`
+ return response;
+ }
+
@Post()
@Authorized("CARD:CREATE")
@ResponseSchema(ResponseRunnerCard)
diff --git a/src/tests/cards/cards_add.spec.ts b/src/tests/cards/cards_add.spec.ts
index 10ee9d4..ef967af 100644
--- a/src/tests/cards/cards_add.spec.ts
+++ b/src/tests/cards/cards_add.spec.ts
@@ -148,4 +148,27 @@ describe('POST /api/cards successfully (with runner)', () => {
"responseType": "RUNNERCARD"
});
});
+});
+// ---------------
+describe('POST /api/cards/bulk successfully', () => {
+ it('creating a single new bulk card should return 200', async () => {
+ const res = await axios.post(base + '/api/cards/bulk?count=1', {}, axios_config);
+ expect(res.status).toEqual(200);
+ expect(res.headers['content-type']).toContain("application/json");
+ });
+ it('creating 50 new bulk card should return 200', async () => {
+ const res = await axios.post(base + '/api/cards/bulk?count=50', {}, axios_config);
+ expect(res.status).toEqual(200);
+ expect(res.headers['content-type']).toContain("application/json");
+ });
+ it('creating 250 new bulk card should return 200', async () => {
+ const res = await axios.post(base + '/api/cards/bulk?count=250', {}, axios_config);
+ expect(res.status).toEqual(200);
+ expect(res.headers['content-type']).toContain("application/json");
+ });
+ it('creating 2000 new bulk card should return 200', async () => {
+ const res = await axios.post(base + '/api/cards/bulk?count=2000', {}, axios_config);
+ expect(res.status).toEqual(200);
+ expect(res.headers['content-type']).toContain("application/json");
+ });
});
\ No newline at end of file