Compare commits

...

12 Commits

Author SHA1 Message Date
6bbdd5bb04
🚀Bumped version to v0.14.4
Some checks reported errors
continuous-integration/drone/pr Build was killed
continuous-integration/drone/push Build is passing
2023-04-15 18:09:49 +02:00
a8fc755840
Back to ean13 based codes
Some checks reported errors
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build is failing
2023-04-15 18:09:24 +02:00
27e74e824c
pinned pnpm to 8
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2023-04-12 14:12:05 +02:00
b5c0a288ac
coherent baseimage
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is passing
2023-03-29 20:35:16 +02:00
85dc3444ac
custom pnpm cache
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is passing
2023-03-29 20:29:56 +02:00
d02743984d
install prod in first step
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is passing
2023-03-29 20:29:08 +02:00
734c826fac
added missing ci env
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2023-03-29 20:27:01 +02:00
33b25c9743
bumped final pnpm version
Some checks reported errors
continuous-integration/drone/pr Build was killed
continuous-integration/drone/push Build is passing
2023-03-29 20:03:38 +02:00
6275aaa326
Switched ci over to pnpm + cache
Some checks reported errors
continuous-integration/drone/pr Build was killed
continuous-integration/drone/push Build is failing
2023-03-29 19:56:05 +02:00
2a94bfa622
pinned pnpm version 2023-03-29 19:53:42 +02:00
a64f6c9822
COPY by stage name 2023-03-29 19:52:59 +02:00
93d43b7684
Switched dockerfile to pnpm 8 with cache 2023-03-29 19:52:31 +02:00
6 changed files with 56 additions and 32 deletions

View File

@ -26,6 +26,13 @@ get:
path: odit-ci-bot path: odit-ci-bot
name: apikey name: apikey
---
kind: secret
name: npm_url
get:
path: odit-npm-cache
name: url
--- ---
kind: pipeline kind: pipeline
type: kubernetes type: kubernetes
@ -41,8 +48,12 @@ steps:
- name: run tests - name: run tests
image: registry.odit.services/hub/library/node:19.5.0-alpine3.16 image: registry.odit.services/hub/library/node:19.5.0-alpine3.16
commands: commands:
- yarn - npm config set registry $NPM_REGISTRY_URL && npm i -g pnpm@8
- yarn test:ci - pnpm i
- pnpm test:ci
environment:
NPM_REGISTRY_URL:
from_secret: npm_url
trigger: trigger:
event: event:
- pull_request - pull_request
@ -69,10 +80,8 @@ steps:
password: password:
from_secret: docker_password from_secret: docker_password
build_args: build_args:
- NPM_REGISTRY_DOMAIN: - NPM_REGISTRY_URL:
from_secret: npmjs_domain from_secret: npm_url
- NPM_REGISTRY_TOKEN:
from_secret: npmjs_token
repo: lfk/backend repo: lfk/backend
tags: tags:
- dev - dev
@ -109,10 +118,8 @@ steps:
password: password:
from_secret: docker_password from_secret: docker_password
build_args: build_args:
- NPM_REGISTRY_DOMAIN: - NPM_REGISTRY_URL:
from_secret: npmjs_domain from_secret: npm_url
- NPM_REGISTRY_TOKEN:
from_secret: npmjs_token
repo: lfk/backend repo: lfk/backend
tags: tags:
- latest - latest
@ -149,10 +156,8 @@ steps:
password: password:
from_secret: docker_password from_secret: docker_password
build_args: build_args:
- NPM_REGISTRY_DOMAIN: - NPM_REGISTRY_URL:
from_secret: npmjs_domain from_secret: npm_url
- NPM_REGISTRY_TOKEN:
from_secret: npmjs_token
repo: lfk/backend repo: lfk/backend
tags: tags:
- "${DRONE_TAG}" - "${DRONE_TAG}"

View File

@ -2,8 +2,25 @@
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.14.4](https://git.odit.services/lfk/backend/compare/v0.14.3...v0.14.4)
- Switched ci over to pnpm + cache [`6275aaa`](https://git.odit.services/lfk/backend/commit/6275aaa326f1c02c8dd42aa31608978408c44ab7)
- Back to ean13 based codes [`a8fc755`](https://git.odit.services/lfk/backend/commit/a8fc7558408b97da4b2c469ae5e73ab502b4fda0)
- install prod in first step [`d027439`](https://git.odit.services/lfk/backend/commit/d02743984dfea8057be3081bd3a32a8f67e610aa)
- Switched dockerfile to pnpm 8 with cache [`93d43b7`](https://git.odit.services/lfk/backend/commit/93d43b76843d7cb411f37fd2066c6a5364c05415)
- COPY by stage name [`a64f6c9`](https://git.odit.services/lfk/backend/commit/a64f6c9822af2b927e91b0b55f1f50176de30169)
- pinned pnpm version [`2a94bfa`](https://git.odit.services/lfk/backend/commit/2a94bfa6227d14f635b5fc2789b59c36d490937e)
- custom pnpm cache [`85dc344`](https://git.odit.services/lfk/backend/commit/85dc3444acc677ddd242f9f2543ce477fe427a7c)
- added missing ci env [`734c826`](https://git.odit.services/lfk/backend/commit/734c826face58dd5c3bb2607bda6e7f6d051012e)
- pinned pnpm to 8 [`27e74e8`](https://git.odit.services/lfk/backend/commit/27e74e824cd1e23d4d53c1a983a1668dd87f5d59)
- coherent baseimage [`b5c0a28`](https://git.odit.services/lfk/backend/commit/b5c0a288ac3c020f5d753c558aee160fea0bae14)
- bumped final pnpm version [`33b25c9`](https://git.odit.services/lfk/backend/commit/33b25c9743abb7cefb3538f08cc2f78a646905c8)
#### [v0.14.3](https://git.odit.services/lfk/backend/compare/v0.14.2...v0.14.3) #### [v0.14.3](https://git.odit.services/lfk/backend/compare/v0.14.2...v0.14.3)
> 18 March 2023
- 🚀Bumped version to v0.14.3 [`16ce0a8`](https://git.odit.services/lfk/backend/commit/16ce0a848050b74c4b6dd93f17e5a6e9024cdb7d)
- Adjusted modulo for new fixed card length [`9a8d618`](https://git.odit.services/lfk/backend/commit/9a8d618ae4584640e8be1ce9fe4bddd2ef7a92ae) - Adjusted modulo for new fixed card length [`9a8d618`](https://git.odit.services/lfk/backend/commit/9a8d618ae4584640e8be1ce9fe4bddd2ef7a92ae)
#### [v0.14.2](https://git.odit.services/lfk/backend/compare/v0.14.1...v0.14.2) #### [v0.14.2](https://git.odit.services/lfk/backend/compare/v0.14.1...v0.14.2)

View File

@ -1,15 +1,20 @@
# Typescript Build # Typescript Build
FROM registry.odit.services/hub/library/node:19.5.0-alpine3.16 FROM registry.odit.services/hub/library/node:19.5.0-alpine3.16 as build
ARG NPM_REGISTRY_URL=https://registry.npmjs.org
WORKDIR /app WORKDIR /app
COPY package.json ./ COPY package.json ./
RUN npx pnpm@7.26.3 i RUN npm config set registry $NPM_REGISTRY_URL && npm i -g pnpm@8
RUN mkdir /pnpm && pnpm config set store-dir /pnpm && pnpm i
COPY tsconfig.json ormconfig.js ./ COPY tsconfig.json ormconfig.js ./
COPY src ./src COPY src ./src
RUN npm run build RUN pnpm run build \
&& rm -rf /app/node_modules \
&& pnpm i --production --prefer-offline
# final image # final image
FROM registry.odit.services/hub/library/node:19.5.0-alpine3.16 FROM registry.odit.services/hub/library/node:19.5.0-alpine3.16 as final
COPY package.json ormconfig.js ./ COPY --from=build /app/dist dist
RUN npx pnpm@7.26.3 i --prod COPY --from=build /app/node_modules /app/node_modules
COPY --from=0 /app/dist dist
ENTRYPOINT ["node", "dist/app.js"] ENTRYPOINT ["node", "dist/app.js"]

View File

@ -1,8 +1,11 @@
{ {
"name": "@odit/lfk-backend", "name": "@odit/lfk-backend",
"version": "0.14.3", "version": "0.14.4",
"main": "src/app.ts", "main": "src/app.ts",
"repository": "https://git.odit.services/lfk/backend", "repository": "https://git.odit.services/lfk/backend",
"engines": {
"pnpm": "8"
},
"author": { "author": {
"name": "ODIT.Services", "name": "ODIT.Services",
"email": "info@odit.services", "email": "info@odit.services",

View File

@ -57,7 +57,7 @@ export class CreateTrackScan {
* @returns The runnerCard whom's id you provided. * @returns The runnerCard whom's id you provided.
*/ */
public async getCard(): Promise<RunnerCard> { public async getCard(): Promise<RunnerCard> {
const id = this.card % 2000000; const id = this.card % 200000000000;
const runnerCard = await getConnection().getRepository(RunnerCard).findOne({ id: id }, { relations: ["runner"] }); const runnerCard = await getConnection().getRepository(RunnerCard).findOne({ id: id }, { relations: ["runner"] });
if (!runnerCard) { if (!runnerCard) {
throw new RunnerCardNotFoundError(); throw new RunnerCardNotFoundError();

View File

@ -52,13 +52,7 @@ export class RunnerCard {
* Generates a ean-13 compliant string for barcode generation. * Generates a ean-13 compliant string for barcode generation.
*/ */
public get code(): string { public get code(): string {
const multiply = [1, 3]; return this.paddedId
let total = 0;
this.paddedId.split('').forEach((letter, index) => {
total += parseInt(letter, 10) * multiply[index % 2];
});
const checkSum = (Math.ceil(total / 10) * 10) - total;
return this.paddedId + checkSum.toString();
} }
/** /**
@ -67,10 +61,10 @@ export class RunnerCard {
private get paddedId(): string { private get paddedId(): string {
let id: string = this.id.toString(); let id: string = this.id.toString();
if (id.length > 6) { if (id.length > 11) {
throw new RunnerCardIdOutOfRangeError(); throw new RunnerCardIdOutOfRangeError();
} }
while (id.length < 6) { id = '0' + id; } while (id.length < 11) { id = '0' + id; }
id = '2' + id; id = '2' + id;
return id; return id;