Spaces:
Sleeping
Sleeping
Commit ·
6f1c297
1
Parent(s): ed9181a
Initial deployment: frontend + omr-service + cluster-server + nginx proxy
Browse files- Pre-built frontend (UmiJS 4 / @umijs/max)
- omr-service (Fastify API, runs via tsx)
- cluster-server (NestJS, SQLite)
- PostgreSQL for omr-service data
- nginx reverse proxy on port 7860
- No ML predictors (lightweight deployment)
- Font files tracked via Git LFS
This view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +5 -0
- .gitignore +3 -0
- Dockerfile +103 -0
- README.md +16 -2
- backend/cluster-server/dist/mikro-orm.config.d.ts +3 -0
- backend/cluster-server/dist/mikro-orm.config.js +23 -0
- backend/cluster-server/dist/mikro-orm.config.js.map +1 -0
- backend/cluster-server/dist/src/app.controller.d.ts +6 -0
- backend/cluster-server/dist/src/app.controller.js +34 -0
- backend/cluster-server/dist/src/app.controller.js.map +1 -0
- backend/cluster-server/dist/src/app.module.d.ts +8 -0
- backend/cluster-server/dist/src/app.module.js +52 -0
- backend/cluster-server/dist/src/app.module.js.map +1 -0
- backend/cluster-server/dist/src/app.service.d.ts +3 -0
- backend/cluster-server/dist/src/app.service.js +20 -0
- backend/cluster-server/dist/src/app.service.js.map +1 -0
- backend/cluster-server/dist/src/filters/http-exception.filter.d.ts +4 -0
- backend/cluster-server/dist/src/filters/http-exception.filter.js +32 -0
- backend/cluster-server/dist/src/filters/http-exception.filter.js.map +1 -0
- backend/cluster-server/dist/src/main.d.ts +1 -0
- backend/cluster-server/dist/src/main.js +20 -0
- backend/cluster-server/dist/src/main.js.map +1 -0
- backend/cluster-server/dist/src/migrations/Migration20220316063840.d.ts +4 -0
- backend/cluster-server/dist/src/migrations/Migration20220316063840.js +14 -0
- backend/cluster-server/dist/src/migrations/Migration20220316063840.js.map +1 -0
- backend/cluster-server/dist/src/scores/dto/create-measure.dto.d.ts +5 -0
- backend/cluster-server/dist/src/scores/dto/create-measure.dto.js +7 -0
- backend/cluster-server/dist/src/scores/dto/create-measure.dto.js.map +1 -0
- backend/cluster-server/dist/src/scores/dto/create-score.dto.d.ts +8 -0
- backend/cluster-server/dist/src/scores/dto/create-score.dto.js +7 -0
- backend/cluster-server/dist/src/scores/dto/create-score.dto.js.map +1 -0
- backend/cluster-server/dist/src/scores/dto/pagination.d.ts +4 -0
- backend/cluster-server/dist/src/scores/dto/pagination.js +25 -0
- backend/cluster-server/dist/src/scores/dto/pagination.js.map +1 -0
- backend/cluster-server/dist/src/scores/entities/measure.entity.d.ts +8 -0
- backend/cluster-server/dist/src/scores/entities/measure.entity.js +37 -0
- backend/cluster-server/dist/src/scores/entities/measure.entity.js.map +1 -0
- backend/cluster-server/dist/src/scores/entities/score.entity.d.ts +9 -0
- backend/cluster-server/dist/src/scores/entities/score.entity.js +50 -0
- backend/cluster-server/dist/src/scores/entities/score.entity.js.map +1 -0
- backend/cluster-server/dist/src/scores/scores.controller.d.ts +19 -0
- backend/cluster-server/dist/src/scores/scores.controller.js +151 -0
- backend/cluster-server/dist/src/scores/scores.controller.js.map +1 -0
- backend/cluster-server/dist/src/scores/scores.module.d.ts +2 -0
- backend/cluster-server/dist/src/scores/scores.module.js +26 -0
- backend/cluster-server/dist/src/scores/scores.module.js.map +1 -0
- backend/cluster-server/dist/src/scores/scores.service.d.ts +23 -0
- backend/cluster-server/dist/src/scores/scores.service.js +85 -0
- backend/cluster-server/dist/src/scores/scores.service.js.map +1 -0
- backend/cluster-server/dist/src/shared/interceptor/transform.interceptor.d.ts +9 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,8 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
*.woff filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
*.ttf filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
*.eot filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
*.otf filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
*.woff2 filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
node_modules/
|
| 2 |
+
*.log
|
| 3 |
+
prepare.sh
|
Dockerfile
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
###############################################################################
|
| 2 |
+
# STARRY HuggingFace Space — Lightweight Deployment
|
| 3 |
+
# nginx (reverse proxy) + omr-service (Fastify) + cluster-server (NestJS)
|
| 4 |
+
# No ML predictors — prediction features are disabled
|
| 5 |
+
###############################################################################
|
| 6 |
+
|
| 7 |
+
FROM node:20-slim
|
| 8 |
+
|
| 9 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
| 10 |
+
|
| 11 |
+
# --- System deps ---
|
| 12 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 13 |
+
postgresql postgresql-client \
|
| 14 |
+
nginx \
|
| 15 |
+
tini \
|
| 16 |
+
python3 make g++ pkg-config \
|
| 17 |
+
libzmq3-dev libfontconfig1 curl \
|
| 18 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 19 |
+
|
| 20 |
+
# Install tsx globally
|
| 21 |
+
RUN npm install -g tsx
|
| 22 |
+
|
| 23 |
+
# --- Create user with UID 1000 (HF Space requirement) ---
|
| 24 |
+
RUN useradd -m -u 1000 user
|
| 25 |
+
|
| 26 |
+
# --- Configure PostgreSQL to run as user (UID 1000) ---
|
| 27 |
+
ENV PGDATA=/home/user/pgdata
|
| 28 |
+
RUN mkdir -p $PGDATA /home/user/run/postgresql \
|
| 29 |
+
&& chown -R user:user $PGDATA /home/user/run/postgresql \
|
| 30 |
+
&& chmod 700 $PGDATA
|
| 31 |
+
|
| 32 |
+
# Initialize PostgreSQL as user
|
| 33 |
+
USER user
|
| 34 |
+
RUN /usr/lib/postgresql/15/bin/initdb -D $PGDATA \
|
| 35 |
+
&& echo "unix_socket_directories = '/home/user/run/postgresql'" >> $PGDATA/postgresql.conf \
|
| 36 |
+
&& echo "listen_addresses = '127.0.0.1'" >> $PGDATA/postgresql.conf \
|
| 37 |
+
&& echo "port = 5432" >> $PGDATA/postgresql.conf \
|
| 38 |
+
&& echo "local all all trust" > $PGDATA/pg_hba.conf \
|
| 39 |
+
&& echo "host all all 127.0.0.1/32 trust" >> $PGDATA/pg_hba.conf
|
| 40 |
+
USER root
|
| 41 |
+
|
| 42 |
+
# --- Configure nginx ---
|
| 43 |
+
RUN mkdir -p /var/log/nginx /var/lib/nginx/body /var/lib/nginx/proxy /var/lib/nginx/fastcgi \
|
| 44 |
+
&& chown -R user:user /var/log/nginx /var/lib/nginx /run /etc/nginx
|
| 45 |
+
|
| 46 |
+
# --- Set up app directory ---
|
| 47 |
+
ENV HOME=/home/user
|
| 48 |
+
WORKDIR /home/user/app
|
| 49 |
+
|
| 50 |
+
# --- cluster-server: install production deps ---
|
| 51 |
+
COPY --chown=user backend/cluster-server/package.json backend/cluster-server/package-lock.json* ./backend/cluster-server/
|
| 52 |
+
RUN cd backend/cluster-server && npm ci --omit=dev --legacy-peer-deps 2>/dev/null || npm install --omit=dev --legacy-peer-deps
|
| 53 |
+
|
| 54 |
+
# --- omr bundle (pre-built) ---
|
| 55 |
+
COPY --chown=user backend/omr/package.json ./backend/omr/
|
| 56 |
+
COPY --chown=user backend/omr/dist/ ./backend/omr/dist/
|
| 57 |
+
|
| 58 |
+
# --- omr-service: install production deps ---
|
| 59 |
+
COPY --chown=user backend/omr-service/package.json backend/omr-service/package-lock.json* ./backend/omr-service/
|
| 60 |
+
RUN cd backend/omr-service && ONNXRUNTIME_NODE_INSTALL=skip npm install --omit=dev 2>/dev/null \
|
| 61 |
+
&& rm -rf node_modules/onnxruntime-node/node_modules/onnxruntime-common 2>/dev/null; true
|
| 62 |
+
|
| 63 |
+
# --- Root-level deps (for omr bundle externals) ---
|
| 64 |
+
RUN npm init -y > /dev/null 2>&1 \
|
| 65 |
+
&& npm install --no-package-lock \
|
| 66 |
+
js-sha1 math-erf lodash spark-md5 portfinder python-shell \
|
| 67 |
+
skia-canvas gl msgpackr "yargs@^17" \
|
| 68 |
+
> /dev/null 2>&1; true
|
| 69 |
+
|
| 70 |
+
# --- Copy pre-built frontend ---
|
| 71 |
+
COPY --chown=user dist/ ./dist/
|
| 72 |
+
|
| 73 |
+
# --- Copy cluster-server dist ---
|
| 74 |
+
COPY --chown=user backend/cluster-server/dist/ ./backend/cluster-server/dist/
|
| 75 |
+
RUN ln -sf /home/user/app/backend/cluster-server/dist/src/migrations /home/user/app/backend/cluster-server/dist/migrations
|
| 76 |
+
|
| 77 |
+
# --- Copy omr-service source ---
|
| 78 |
+
COPY --chown=user backend/omr-service/src/ ./backend/omr-service/src/
|
| 79 |
+
COPY --chown=user backend/omr-service/tsconfig.json ./backend/omr-service/
|
| 80 |
+
|
| 81 |
+
# --- Gauge renderer and shared files ---
|
| 82 |
+
COPY --chown=user backend/libs/gauge-renderer.ts ./backend/libs/
|
| 83 |
+
COPY --chown=user backend/omr/src/gauge-server.ts ./backend/omr/src/
|
| 84 |
+
COPY --chown=user src/pages/playground/scripts/shaders.ts ./src/pages/playground/scripts/
|
| 85 |
+
RUN ln -sf /home/user/app/backend/omr-service/node_modules /home/user/app/backend/node_modules
|
| 86 |
+
|
| 87 |
+
# --- Root tsconfig ---
|
| 88 |
+
COPY --chown=user tsconfig.json ./
|
| 89 |
+
|
| 90 |
+
# --- Config files ---
|
| 91 |
+
COPY --chown=user docker-entrypoint.sh ./docker-entrypoint.sh
|
| 92 |
+
COPY --chown=user nginx.conf /etc/nginx/nginx.conf
|
| 93 |
+
RUN chmod +x docker-entrypoint.sh
|
| 94 |
+
|
| 95 |
+
# Directories
|
| 96 |
+
RUN mkdir -p /tmp/starry-uploads && chown user:user /tmp/starry-uploads
|
| 97 |
+
|
| 98 |
+
USER user
|
| 99 |
+
|
| 100 |
+
EXPOSE 7860
|
| 101 |
+
|
| 102 |
+
ENTRYPOINT ["tini", "--"]
|
| 103 |
+
CMD ["./docker-entrypoint.sh"]
|
README.md
CHANGED
|
@@ -1,11 +1,25 @@
|
|
| 1 |
---
|
| 2 |
title: Starry
|
| 3 |
-
emoji:
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: pink
|
| 6 |
sdk: docker
|
| 7 |
pinned: false
|
| 8 |
license: bsd
|
|
|
|
| 9 |
---
|
| 10 |
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
title: Starry
|
| 3 |
+
emoji: 🎵
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: pink
|
| 6 |
sdk: docker
|
| 7 |
pinned: false
|
| 8 |
license: bsd
|
| 9 |
+
app_port: 7860
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# STARRY — Sheet Music Recognition
|
| 13 |
+
|
| 14 |
+
Online sheet music recognition and editing platform.
|
| 15 |
+
|
| 16 |
+
## Features
|
| 17 |
+
|
| 18 |
+
- Upload and manage music score images
|
| 19 |
+
- Automatic OMR (Optical Music Recognition) processing
|
| 20 |
+
- Score editing and annotation
|
| 21 |
+
- Music set management
|
| 22 |
+
|
| 23 |
+
## Note
|
| 24 |
+
|
| 25 |
+
This is a lightweight deployment. ML prediction services (layout, gauge, mask, semantic, OCR) are not included in this Space.
|
backend/cluster-server/dist/mikro-orm.config.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { MikroOrmModuleOptions as Options } from '@mikro-orm/nestjs';
|
| 2 |
+
declare const config: Options;
|
| 3 |
+
export default config;
|
backend/cluster-server/dist/mikro-orm.config.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 3 |
+
const sql_highlighter_1 = require("@mikro-orm/sql-highlighter");
|
| 4 |
+
const reflection_1 = require("@mikro-orm/reflection");
|
| 5 |
+
const core_1 = require("@mikro-orm/core");
|
| 6 |
+
const config = {
|
| 7 |
+
dbName: 'cluster.sqlite3',
|
| 8 |
+
type: 'sqlite',
|
| 9 |
+
autoLoadEntities: true,
|
| 10 |
+
entities: ['dist/**/*.entity.js'],
|
| 11 |
+
entitiesTs: ['src/**/*.entity.ts'],
|
| 12 |
+
debug: true,
|
| 13 |
+
loadStrategy: core_1.LoadStrategy.JOINED,
|
| 14 |
+
highlighter: new sql_highlighter_1.SqlHighlighter(),
|
| 15 |
+
metadataProvider: reflection_1.TsMorphMetadataProvider,
|
| 16 |
+
registerRequestContext: false,
|
| 17 |
+
migrations: {
|
| 18 |
+
path: 'dist/migrations',
|
| 19 |
+
pathTs: 'src/migrations',
|
| 20 |
+
},
|
| 21 |
+
};
|
| 22 |
+
exports.default = config;
|
| 23 |
+
//# sourceMappingURL=mikro-orm.config.js.map
|
backend/cluster-server/dist/mikro-orm.config.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"mikro-orm.config.js","sourceRoot":"","sources":["../mikro-orm.config.ts"],"names":[],"mappings":";;AACA,gEAA4D;AAC5D,sDAAgE;AAChE,0CAA+C;AAE/C,MAAM,MAAM,GAAY;IACvB,MAAM,EAAE,iBAAiB;IACzB,IAAI,EAAE,QAAQ;IACd,gBAAgB,EAAE,IAAI;IACtB,QAAQ,EAAE,CAAC,qBAAqB,CAAC;IACjC,UAAU,EAAE,CAAC,oBAAoB,CAAC;IAClC,KAAK,EAAE,IAAI;IAEX,YAAY,EAAE,mBAAY,CAAC,MAAM;IACjC,WAAW,EAAE,IAAI,gCAAc,EAAE;IACjC,gBAAgB,EAAE,oCAAuB;IACzC,sBAAsB,EAAE,KAAK;IAC7B,UAAU,EAAE;QACX,IAAI,EAAE,iBAAiB;QACvB,MAAM,EAAE,gBAAgB;KACxB;CACD,CAAC;AAEF,kBAAe,MAAM,CAAC"}
|
backend/cluster-server/dist/src/app.controller.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { AppService } from './app.service';
|
| 2 |
+
export declare class AppController {
|
| 3 |
+
private readonly appService;
|
| 4 |
+
constructor(appService: AppService);
|
| 5 |
+
getHello(): string;
|
| 6 |
+
}
|
backend/cluster-server/dist/src/app.controller.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
| 3 |
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
| 4 |
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
| 5 |
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
| 6 |
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
| 7 |
+
};
|
| 8 |
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
| 9 |
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
| 10 |
+
};
|
| 11 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 12 |
+
exports.AppController = void 0;
|
| 13 |
+
const common_1 = require("@nestjs/common");
|
| 14 |
+
const app_service_1 = require("./app.service");
|
| 15 |
+
let AppController = class AppController {
|
| 16 |
+
constructor(appService) {
|
| 17 |
+
this.appService = appService;
|
| 18 |
+
}
|
| 19 |
+
getHello() {
|
| 20 |
+
return this.appService.getHello();
|
| 21 |
+
}
|
| 22 |
+
};
|
| 23 |
+
__decorate([
|
| 24 |
+
(0, common_1.Get)(),
|
| 25 |
+
__metadata("design:type", Function),
|
| 26 |
+
__metadata("design:paramtypes", []),
|
| 27 |
+
__metadata("design:returntype", String)
|
| 28 |
+
], AppController.prototype, "getHello", null);
|
| 29 |
+
AppController = __decorate([
|
| 30 |
+
(0, common_1.Controller)(),
|
| 31 |
+
__metadata("design:paramtypes", [app_service_1.AppService])
|
| 32 |
+
], AppController);
|
| 33 |
+
exports.AppController = AppController;
|
| 34 |
+
//# sourceMappingURL=app.controller.js.map
|
backend/cluster-server/dist/src/app.controller.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"app.controller.js","sourceRoot":"","sources":["../../src/app.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAiD;AACjD,+CAA2C;AAGpC,IAAM,aAAa,GAAnB,MAAM,aAAa;IACzB,YAA6B,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAG,CAAC;IAGvD,QAAQ;QACP,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;IACnC,CAAC;CACD,CAAA;AAJA;IAAC,IAAA,YAAG,GAAE;;;;6CAGL;AANW,aAAa;IADzB,IAAA,mBAAU,GAAE;qCAE6B,wBAAU;GADvC,aAAa,CAOzB;AAPY,sCAAa"}
|
backend/cluster-server/dist/src/app.module.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { MiddlewareConsumer, NestModule, OnModuleInit } from '@nestjs/common';
|
| 2 |
+
import { MikroORM } from '@mikro-orm/core';
|
| 3 |
+
export declare class AppModule implements NestModule, OnModuleInit {
|
| 4 |
+
private readonly orm;
|
| 5 |
+
constructor(orm: MikroORM);
|
| 6 |
+
onModuleInit(): Promise<void>;
|
| 7 |
+
configure(consumer: MiddlewareConsumer): void;
|
| 8 |
+
}
|
backend/cluster-server/dist/src/app.module.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
| 3 |
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
| 4 |
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
| 5 |
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
| 6 |
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
| 7 |
+
};
|
| 8 |
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
| 9 |
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
| 10 |
+
};
|
| 11 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 12 |
+
exports.AppModule = void 0;
|
| 13 |
+
const common_1 = require("@nestjs/common");
|
| 14 |
+
const app_controller_1 = require("./app.controller");
|
| 15 |
+
const app_service_1 = require("./app.service");
|
| 16 |
+
const nestjs_1 = require("@mikro-orm/nestjs");
|
| 17 |
+
const scores_module_1 = require("./scores/scores.module");
|
| 18 |
+
const core_1 = require("@mikro-orm/core");
|
| 19 |
+
const core_2 = require("@nestjs/core");
|
| 20 |
+
const transform_interceptor_1 = require("./shared/interceptor/transform.interceptor");
|
| 21 |
+
const http_exception_filter_1 = require("./filters/http-exception.filter");
|
| 22 |
+
let AppModule = class AppModule {
|
| 23 |
+
constructor(orm) {
|
| 24 |
+
this.orm = orm;
|
| 25 |
+
}
|
| 26 |
+
async onModuleInit() {
|
| 27 |
+
await this.orm.getMigrator().up();
|
| 28 |
+
}
|
| 29 |
+
configure(consumer) {
|
| 30 |
+
consumer.apply(nestjs_1.MikroOrmMiddleware).forRoutes('*');
|
| 31 |
+
}
|
| 32 |
+
};
|
| 33 |
+
AppModule = __decorate([
|
| 34 |
+
(0, common_1.Module)({
|
| 35 |
+
imports: [nestjs_1.MikroOrmModule.forRoot(), scores_module_1.ScoresModule],
|
| 36 |
+
controllers: [app_controller_1.AppController],
|
| 37 |
+
providers: [
|
| 38 |
+
{
|
| 39 |
+
provide: core_2.APP_INTERCEPTOR,
|
| 40 |
+
useClass: transform_interceptor_1.TransformInterceptor,
|
| 41 |
+
},
|
| 42 |
+
{
|
| 43 |
+
provide: core_2.APP_FILTER,
|
| 44 |
+
useClass: http_exception_filter_1.HttpExceptionFilter,
|
| 45 |
+
},
|
| 46 |
+
app_service_1.AppService,
|
| 47 |
+
],
|
| 48 |
+
}),
|
| 49 |
+
__metadata("design:paramtypes", [core_1.MikroORM])
|
| 50 |
+
], AppModule);
|
| 51 |
+
exports.AppModule = AppModule;
|
| 52 |
+
//# sourceMappingURL=app.module.js.map
|
backend/cluster-server/dist/src/app.module.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"app.module.js","sourceRoot":"","sources":["../../src/app.module.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAsF;AACtF,qDAAiD;AACjD,+CAA2C;AAC3C,8CAAuE;AACvE,0DAAsD;AACtD,0CAA2C;AAC3C,uCAA2D;AAC3D,sFAAkF;AAClF,2EAAsE;AAiB/D,IAAM,SAAS,GAAf,MAAM,SAAS;IACrB,YAA6B,GAAa;QAAb,QAAG,GAAH,GAAG,CAAU;IAAG,CAAC;IAE9C,KAAK,CAAC,YAAY;QACjB,MAAM,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,EAAE,EAAE,CAAC;IACnC,CAAC;IAID,SAAS,CAAC,QAA4B;QACrC,QAAQ,CAAC,KAAK,CAAC,2BAAkB,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACnD,CAAC;CACD,CAAA;AAZY,SAAS;IAfrB,IAAA,eAAM,EAAC;QACP,OAAO,EAAE,CAAC,uBAAc,CAAC,OAAO,EAAE,EAAE,4BAAY,CAAC;QACjD,WAAW,EAAE,CAAC,8BAAa,CAAC;QAC5B,SAAS,EAAE;YACV;gBACC,OAAO,EAAE,sBAAe;gBACxB,QAAQ,EAAE,4CAAoB;aAC9B;YACD;gBACC,OAAO,EAAE,iBAAU;gBACnB,QAAQ,EAAE,2CAAmB;aAC7B;YACD,wBAAU;SACV;KACD,CAAC;qCAEiC,eAAQ;GAD9B,SAAS,CAYrB;AAZY,8BAAS"}
|
backend/cluster-server/dist/src/app.service.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export declare class AppService {
|
| 2 |
+
getHello(): string;
|
| 3 |
+
}
|
backend/cluster-server/dist/src/app.service.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
| 3 |
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
| 4 |
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
| 5 |
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
| 6 |
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
| 7 |
+
};
|
| 8 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 9 |
+
exports.AppService = void 0;
|
| 10 |
+
const common_1 = require("@nestjs/common");
|
| 11 |
+
let AppService = class AppService {
|
| 12 |
+
getHello() {
|
| 13 |
+
return 'Hello World!';
|
| 14 |
+
}
|
| 15 |
+
};
|
| 16 |
+
AppService = __decorate([
|
| 17 |
+
(0, common_1.Injectable)()
|
| 18 |
+
], AppService);
|
| 19 |
+
exports.AppService = AppService;
|
| 20 |
+
//# sourceMappingURL=app.service.js.map
|
backend/cluster-server/dist/src/app.service.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"app.service.js","sourceRoot":"","sources":["../../src/app.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAGrC,IAAM,UAAU,GAAhB,MAAM,UAAU;IACtB,QAAQ;QACP,OAAO,cAAc,CAAC;IACvB,CAAC;CACD,CAAA;AAJY,UAAU;IADtB,IAAA,mBAAU,GAAE;GACA,UAAU,CAItB;AAJY,gCAAU"}
|
backend/cluster-server/dist/src/filters/http-exception.filter.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { ArgumentsHost, ExceptionFilter, HttpException } from '@nestjs/common';
|
| 2 |
+
export declare class HttpExceptionFilter implements ExceptionFilter {
|
| 3 |
+
catch(exception: HttpException, host: ArgumentsHost): void;
|
| 4 |
+
}
|
backend/cluster-server/dist/src/filters/http-exception.filter.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
| 3 |
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
| 4 |
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
| 5 |
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
| 6 |
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
| 7 |
+
};
|
| 8 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 9 |
+
exports.HttpExceptionFilter = void 0;
|
| 10 |
+
const common_1 = require("@nestjs/common");
|
| 11 |
+
let HttpExceptionFilter = class HttpExceptionFilter {
|
| 12 |
+
catch(exception, host) {
|
| 13 |
+
const ctx = host.switchToHttp();
|
| 14 |
+
const response = ctx.getResponse();
|
| 15 |
+
const request = ctx.getRequest();
|
| 16 |
+
const message = exception.message;
|
| 17 |
+
common_1.Logger.log('错误提示', message);
|
| 18 |
+
const status = exception instanceof common_1.HttpException ? exception.getStatus() : common_1.HttpStatus.INTERNAL_SERVER_ERROR;
|
| 19 |
+
response.status(status);
|
| 20 |
+
response.header('Content-Type', 'application/json; charset=utf-8');
|
| 21 |
+
response.send({
|
| 22 |
+
data: null,
|
| 23 |
+
message: `${request.originalUrl} 请求失败`,
|
| 24 |
+
code: -1,
|
| 25 |
+
});
|
| 26 |
+
}
|
| 27 |
+
};
|
| 28 |
+
HttpExceptionFilter = __decorate([
|
| 29 |
+
(0, common_1.Catch)(common_1.HttpException)
|
| 30 |
+
], HttpExceptionFilter);
|
| 31 |
+
exports.HttpExceptionFilter = HttpExceptionFilter;
|
| 32 |
+
//# sourceMappingURL=http-exception.filter.js.map
|
backend/cluster-server/dist/src/filters/http-exception.filter.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"http-exception.filter.js","sourceRoot":"","sources":["../../../src/filters/http-exception.filter.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA0G;AAGnG,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAC/B,KAAK,CAAC,SAAwB,EAAE,IAAmB;QAClD,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAChC,MAAM,QAAQ,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;QACnC,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC;QAEjC,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC;QAClC,eAAM,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC5B,MAAM,MAAM,GAAG,SAAS,YAAY,sBAAa,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,mBAAU,CAAC,qBAAqB,CAAC;QAC7G,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACxB,QAAQ,CAAC,MAAM,CAAC,cAAc,EAAE,iCAAiC,CAAC,CAAC;QACnE,QAAQ,CAAC,IAAI,CAAC;YACb,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,GAAG,OAAO,CAAC,WAAW,OAAO;YACtC,IAAI,EAAE,CAAC,CAAC;SACR,CAAC,CAAC;IACJ,CAAC;CACD,CAAA;AAjBY,mBAAmB;IAD/B,IAAA,cAAK,EAAC,sBAAa,CAAC;GACR,mBAAmB,CAiB/B;AAjBY,kDAAmB"}
|
backend/cluster-server/dist/src/main.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
export {};
|
backend/cluster-server/dist/src/main.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 3 |
+
const core_1 = require("@nestjs/core");
|
| 4 |
+
const app_module_1 = require("./app.module");
|
| 5 |
+
const swagger_1 = require("@nestjs/swagger");
|
| 6 |
+
const bodyParser = require("body-parser");
|
| 7 |
+
async function bootstrap() {
|
| 8 |
+
const app = await core_1.NestFactory.create(app_module_1.AppModule);
|
| 9 |
+
app.setGlobalPrefix('api');
|
| 10 |
+
app.use(bodyParser.json({ limit: '50mb' }));
|
| 11 |
+
app.use(bodyParser.urlencoded({ limit: '50mb', extended: true }));
|
| 12 |
+
app.enableCors();
|
| 13 |
+
const options = new swagger_1.DocumentBuilder().setTitle('Cluster Server').setDescription('cluster manager').setVersion('1.0').addBearerAuth().build();
|
| 14 |
+
const document = swagger_1.SwaggerModule.createDocument(app, options);
|
| 15 |
+
swagger_1.SwaggerModule.setup('/docs', app, document);
|
| 16 |
+
app.enableShutdownHooks();
|
| 17 |
+
await app.listen(process.env.PORT || 3000);
|
| 18 |
+
}
|
| 19 |
+
bootstrap();
|
| 20 |
+
//# sourceMappingURL=main.js.map
|
backend/cluster-server/dist/src/main.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/main.ts"],"names":[],"mappings":";;AAAA,uCAA2C;AAC3C,6CAAyC;AACzC,6CAAiE;AACjE,0CAA0C;AAE1C,KAAK,UAAU,SAAS;IACvB,MAAM,GAAG,GAAG,MAAM,kBAAW,CAAC,MAAM,CAAC,sBAAS,CAAC,CAAC;IAEhD,GAAG,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IAE3B,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;IAC5C,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAClE,GAAG,CAAC,UAAU,EAAE,CAAC;IAEjB,MAAM,OAAO,GAAG,IAAI,yBAAe,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,CAAC;IAC7I,MAAM,QAAQ,GAAG,uBAAa,CAAC,cAAc,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC5D,uBAAa,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;IAE5C,GAAG,CAAC,mBAAmB,EAAE,CAAC;IAE1B,MAAM,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC;AAC5C,CAAC;AAED,SAAS,EAAE,CAAC"}
|
backend/cluster-server/dist/src/migrations/Migration20220316063840.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Migration } from '@mikro-orm/migrations';
|
| 2 |
+
export declare class Migration20220316063840 extends Migration {
|
| 3 |
+
up(): Promise<void>;
|
| 4 |
+
}
|
backend/cluster-server/dist/src/migrations/Migration20220316063840.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 3 |
+
exports.Migration20220316063840 = void 0;
|
| 4 |
+
const migrations_1 = require("@mikro-orm/migrations");
|
| 5 |
+
class Migration20220316063840 extends migrations_1.Migration {
|
| 6 |
+
async up() {
|
| 7 |
+
this.addSql('create table `score_entity` (`id` text not null, `name` text null, `created_at` datetime not null, `updated_at` datetime not null, primary key (`id`));');
|
| 8 |
+
this.addSql('create table `measure_entity` (`score_id` text not null, `index` text not null, `cluster` json not null, constraint `measure_entity_score_id_foreign` foreign key(`score_id`) references `score_entity`(`id`) on delete cascade on update cascade, primary key (`score_id`, `index`));');
|
| 9 |
+
this.addSql('create index `measure_entity_score_id_index` on `measure_entity` (`score_id`);');
|
| 10 |
+
this.addSql('create index `measure_entity_score_id_index_index` on `measure_entity` (`score_id`, `index`);');
|
| 11 |
+
}
|
| 12 |
+
}
|
| 13 |
+
exports.Migration20220316063840 = Migration20220316063840;
|
| 14 |
+
//# sourceMappingURL=Migration20220316063840.js.map
|
backend/cluster-server/dist/src/migrations/Migration20220316063840.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"Migration20220316063840.js","sourceRoot":"","sources":["../../../src/migrations/Migration20220316063840.ts"],"names":[],"mappings":";;;AAAA,sDAAkD;AAElD,MAAa,uBAAwB,SAAQ,sBAAS;IACrD,KAAK,CAAC,EAAE;QACP,IAAI,CAAC,MAAM,CACV,yJAAyJ,CACzJ,CAAC;QAEF,IAAI,CAAC,MAAM,CACV,wRAAwR,CACxR,CAAC;QACF,IAAI,CAAC,MAAM,CAAC,gFAAgF,CAAC,CAAC;QAC9F,IAAI,CAAC,MAAM,CAAC,+FAA+F,CAAC,CAAC;IAC9G,CAAC;CACD;AAZD,0DAYC"}
|
backend/cluster-server/dist/src/scores/dto/create-measure.dto.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export declare class CreateMeasureDto {
|
| 2 |
+
scoreId: string;
|
| 3 |
+
index: string;
|
| 4 |
+
cluster: Record<any, any>;
|
| 5 |
+
}
|
backend/cluster-server/dist/src/scores/dto/create-measure.dto.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 3 |
+
exports.CreateMeasureDto = void 0;
|
| 4 |
+
class CreateMeasureDto {
|
| 5 |
+
}
|
| 6 |
+
exports.CreateMeasureDto = CreateMeasureDto;
|
| 7 |
+
//# sourceMappingURL=create-measure.dto.js.map
|
backend/cluster-server/dist/src/scores/dto/create-measure.dto.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"create-measure.dto.js","sourceRoot":"","sources":["../../../../src/scores/dto/create-measure.dto.ts"],"names":[],"mappings":";;;AAAA,MAAa,gBAAgB;CAI5B;AAJD,4CAIC"}
|
backend/cluster-server/dist/src/scores/dto/create-score.dto.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export declare class CreateScoreDto {
|
| 2 |
+
id: string;
|
| 3 |
+
name?: string;
|
| 4 |
+
measures: {
|
| 5 |
+
index: string;
|
| 6 |
+
cluster: Record<any, any>;
|
| 7 |
+
}[];
|
| 8 |
+
}
|
backend/cluster-server/dist/src/scores/dto/create-score.dto.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 3 |
+
exports.CreateScoreDto = void 0;
|
| 4 |
+
class CreateScoreDto {
|
| 5 |
+
}
|
| 6 |
+
exports.CreateScoreDto = CreateScoreDto;
|
| 7 |
+
//# sourceMappingURL=create-score.dto.js.map
|
backend/cluster-server/dist/src/scores/dto/create-score.dto.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"create-score.dto.js","sourceRoot":"","sources":["../../../../src/scores/dto/create-score.dto.ts"],"names":[],"mappings":";;;AAAA,MAAa,cAAc;CAO1B;AAPD,wCAOC"}
|
backend/cluster-server/dist/src/scores/dto/pagination.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export declare class Pagination {
|
| 2 |
+
offset?: number;
|
| 3 |
+
limit?: number;
|
| 4 |
+
}
|
backend/cluster-server/dist/src/scores/dto/pagination.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
| 3 |
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
| 4 |
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
| 5 |
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
| 6 |
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
| 7 |
+
};
|
| 8 |
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
| 9 |
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
| 10 |
+
};
|
| 11 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 12 |
+
exports.Pagination = void 0;
|
| 13 |
+
const swagger_1 = require("@nestjs/swagger");
|
| 14 |
+
class Pagination {
|
| 15 |
+
}
|
| 16 |
+
__decorate([
|
| 17 |
+
(0, swagger_1.ApiPropertyOptional)(),
|
| 18 |
+
__metadata("design:type", Number)
|
| 19 |
+
], Pagination.prototype, "offset", void 0);
|
| 20 |
+
__decorate([
|
| 21 |
+
(0, swagger_1.ApiPropertyOptional)(),
|
| 22 |
+
__metadata("design:type", Number)
|
| 23 |
+
], Pagination.prototype, "limit", void 0);
|
| 24 |
+
exports.Pagination = Pagination;
|
| 25 |
+
//# sourceMappingURL=pagination.js.map
|
backend/cluster-server/dist/src/scores/dto/pagination.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../../../src/scores/dto/pagination.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAsD;AAEtD,MAAa,UAAU;CAMtB;AALA;IAAC,IAAA,6BAAmB,GAAE;;0CACN;AAEhB;IAAC,IAAA,6BAAmB,GAAE;;yCACP;AALhB,gCAMC"}
|
backend/cluster-server/dist/src/scores/entities/measure.entity.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { PrimaryKeyType } from '@mikro-orm/core';
|
| 2 |
+
import { ScoreEntity } from './score.entity';
|
| 3 |
+
export declare class MeasureEntity {
|
| 4 |
+
score: ScoreEntity;
|
| 5 |
+
index: string;
|
| 6 |
+
[PrimaryKeyType]?: [string, string];
|
| 7 |
+
cluster: Record<any, any>;
|
| 8 |
+
}
|
backend/cluster-server/dist/src/scores/entities/measure.entity.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
| 3 |
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
| 4 |
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
| 5 |
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
| 6 |
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
| 7 |
+
};
|
| 8 |
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
| 9 |
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
| 10 |
+
};
|
| 11 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 12 |
+
exports.MeasureEntity = void 0;
|
| 13 |
+
const core_1 = require("@mikro-orm/core");
|
| 14 |
+
const score_entity_1 = require("./score.entity");
|
| 15 |
+
const swagger_1 = require("@nestjs/swagger");
|
| 16 |
+
let MeasureEntity = class MeasureEntity {
|
| 17 |
+
};
|
| 18 |
+
__decorate([
|
| 19 |
+
(0, core_1.ManyToOne)({ primary: true, hidden: true, onDelete: 'cascade' }),
|
| 20 |
+
__metadata("design:type", score_entity_1.ScoreEntity)
|
| 21 |
+
], MeasureEntity.prototype, "score", void 0);
|
| 22 |
+
__decorate([
|
| 23 |
+
(0, swagger_1.ApiProperty)(),
|
| 24 |
+
(0, core_1.PrimaryKey)(),
|
| 25 |
+
__metadata("design:type", String)
|
| 26 |
+
], MeasureEntity.prototype, "index", void 0);
|
| 27 |
+
__decorate([
|
| 28 |
+
(0, swagger_1.ApiProperty)({ type: () => core_1.JsonType }),
|
| 29 |
+
(0, core_1.Property)({ type: core_1.JsonType }),
|
| 30 |
+
__metadata("design:type", Object)
|
| 31 |
+
], MeasureEntity.prototype, "cluster", void 0);
|
| 32 |
+
MeasureEntity = __decorate([
|
| 33 |
+
(0, core_1.Index)({ properties: ['score', 'index'] }),
|
| 34 |
+
(0, core_1.Entity)()
|
| 35 |
+
], MeasureEntity);
|
| 36 |
+
exports.MeasureEntity = MeasureEntity;
|
| 37 |
+
//# sourceMappingURL=measure.entity.js.map
|
backend/cluster-server/dist/src/scores/entities/measure.entity.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"measure.entity.js","sourceRoot":"","sources":["../../../../src/scores/entities/measure.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAA2G;AAC3G,iDAA6C;AAC7C,6CAA8C;AAIvC,IAAM,aAAa,GAAnB,MAAM,aAAa;CAazB,CAAA;AAZA;IAAC,IAAA,gBAAS,EAAC,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;8BACxD,0BAAW;4CAAC;AAEpB;IAAC,IAAA,qBAAW,GAAE;IACb,IAAA,iBAAU,GAAE;;4CACE;AAIf;IAAC,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,eAAQ,EAAE,CAAC;IACrC,IAAA,eAAQ,EAAC,EAAE,IAAI,EAAE,eAAQ,EAAE,CAAC;;8CACH;AAZd,aAAa;IAFzB,IAAA,YAAK,EAAC,EAAE,UAAU,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC;IACzC,IAAA,aAAM,GAAE;GACI,aAAa,CAazB;AAbY,sCAAa"}
|
backend/cluster-server/dist/src/scores/entities/score.entity.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Collection } from '@mikro-orm/core';
|
| 2 |
+
import { MeasureEntity } from './measure.entity';
|
| 3 |
+
export declare class ScoreEntity {
|
| 4 |
+
id: string;
|
| 5 |
+
name?: string;
|
| 6 |
+
measures: Collection<MeasureEntity, object>;
|
| 7 |
+
createdAt: Date;
|
| 8 |
+
updatedAt: Date;
|
| 9 |
+
}
|
backend/cluster-server/dist/src/scores/entities/score.entity.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
| 3 |
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
| 4 |
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
| 5 |
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
| 6 |
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
| 7 |
+
};
|
| 8 |
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
| 9 |
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
| 10 |
+
};
|
| 11 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 12 |
+
exports.ScoreEntity = void 0;
|
| 13 |
+
const core_1 = require("@mikro-orm/core");
|
| 14 |
+
const measure_entity_1 = require("./measure.entity");
|
| 15 |
+
const swagger_1 = require("@nestjs/swagger");
|
| 16 |
+
let ScoreEntity = class ScoreEntity {
|
| 17 |
+
constructor() {
|
| 18 |
+
this.measures = new core_1.Collection(this);
|
| 19 |
+
this.createdAt = new Date();
|
| 20 |
+
this.updatedAt = new Date();
|
| 21 |
+
}
|
| 22 |
+
};
|
| 23 |
+
__decorate([
|
| 24 |
+
(0, swagger_1.ApiProperty)(),
|
| 25 |
+
(0, core_1.PrimaryKey)(),
|
| 26 |
+
__metadata("design:type", String)
|
| 27 |
+
], ScoreEntity.prototype, "id", void 0);
|
| 28 |
+
__decorate([
|
| 29 |
+
(0, swagger_1.ApiPropertyOptional)(),
|
| 30 |
+
(0, core_1.Property)({ nullable: true }),
|
| 31 |
+
__metadata("design:type", String)
|
| 32 |
+
], ScoreEntity.prototype, "name", void 0);
|
| 33 |
+
__decorate([
|
| 34 |
+
(0, swagger_1.ApiProperty)({ type: () => [measure_entity_1.MeasureEntity] }),
|
| 35 |
+
(0, core_1.OneToMany)(() => measure_entity_1.MeasureEntity, (item) => item.score, { cascade: [core_1.Cascade.ALL], orphanRemoval: true }),
|
| 36 |
+
__metadata("design:type", Object)
|
| 37 |
+
], ScoreEntity.prototype, "measures", void 0);
|
| 38 |
+
__decorate([
|
| 39 |
+
(0, core_1.Property)({ hidden: true }),
|
| 40 |
+
__metadata("design:type", Object)
|
| 41 |
+
], ScoreEntity.prototype, "createdAt", void 0);
|
| 42 |
+
__decorate([
|
| 43 |
+
(0, core_1.Property)({ hidden: true, onUpdate: () => new Date() }),
|
| 44 |
+
__metadata("design:type", Object)
|
| 45 |
+
], ScoreEntity.prototype, "updatedAt", void 0);
|
| 46 |
+
ScoreEntity = __decorate([
|
| 47 |
+
(0, core_1.Entity)()
|
| 48 |
+
], ScoreEntity);
|
| 49 |
+
exports.ScoreEntity = ScoreEntity;
|
| 50 |
+
//# sourceMappingURL=score.entity.js.map
|
backend/cluster-server/dist/src/scores/entities/score.entity.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"score.entity.js","sourceRoot":"","sources":["../../../../src/scores/entities/score.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAA+F;AAC/F,qDAAiD;AACjD,6CAAmE;AAG5D,IAAM,WAAW,GAAjB,MAAM,WAAW;IAAjB;QAWN,aAAQ,GAAG,IAAI,iBAAU,CAAgB,IAAI,CAAC,CAAC;QAG/C,cAAS,GAAG,IAAI,IAAI,EAAE,CAAC;QAGvB,cAAS,GAAG,IAAI,IAAI,EAAE,CAAC;IACxB,CAAC;CAAA,CAAA;AAjBA;IAAC,IAAA,qBAAW,GAAE;IACb,IAAA,iBAAU,GAAE;;uCACD;AAEZ;IAAC,IAAA,6BAAmB,GAAE;IACrB,IAAA,eAAQ,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCACf;AAEd;IAAC,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,8BAAa,CAAC,EAAE,CAAC;IAC5C,IAAA,gBAAS,EAAC,GAAG,EAAE,CAAC,8BAAa,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,CAAC,cAAO,CAAC,GAAG,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;;6CACvD;AAE/C;IAAC,IAAA,eAAQ,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;;8CACJ;AAEvB;IAAC,IAAA,eAAQ,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;;8CAChC;AAjBX,WAAW;IADvB,IAAA,aAAM,GAAE;GACI,WAAW,CAkBvB;AAlBY,kCAAW"}
|
backend/cluster-server/dist/src/scores/scores.controller.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { ScoresService } from './scores.service';
|
| 2 |
+
import { CreateScoreDto } from './dto/create-score.dto';
|
| 3 |
+
import { ScoreEntity } from './entities/score.entity';
|
| 4 |
+
import { MeasureEntity } from './entities/measure.entity';
|
| 5 |
+
import { Pagination } from './dto/pagination';
|
| 6 |
+
export declare class ScoresController {
|
| 7 |
+
private readonly scoresService;
|
| 8 |
+
constructor(scoresService: ScoresService);
|
| 9 |
+
upsertScore(scoreId: string, createMeasureDto: CreateScoreDto): Promise<import("@mikro-orm/core").Loaded<ScoreEntity, never>>;
|
| 10 |
+
upsertMeasure(scoreId: string, index: string, cluster: Record<any, any>): Promise<import("@mikro-orm/core").Loaded<MeasureEntity, never>>;
|
| 11 |
+
allScore(query: Pagination): Promise<{
|
| 12 |
+
data: import("@mikro-orm/core").Loaded<ScoreEntity, never>[];
|
| 13 |
+
total: number;
|
| 14 |
+
}>;
|
| 15 |
+
findOneScore(scoreId: string): Promise<import("@mikro-orm/core").Loaded<ScoreEntity, never>>;
|
| 16 |
+
findOneMeasure(scoreId: string, index: string): Promise<import("@mikro-orm/core").Loaded<MeasureEntity, never>>;
|
| 17 |
+
removeScore(scoreId: string): Promise<string>;
|
| 18 |
+
removeMeasure(scoreId: string, index: string): Promise<string>;
|
| 19 |
+
}
|
backend/cluster-server/dist/src/scores/scores.controller.js
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
| 3 |
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
| 4 |
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
| 5 |
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
| 6 |
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
| 7 |
+
};
|
| 8 |
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
| 9 |
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
| 10 |
+
};
|
| 11 |
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
| 12 |
+
return function (target, key) { decorator(target, key, paramIndex); }
|
| 13 |
+
};
|
| 14 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 15 |
+
exports.ScoresController = void 0;
|
| 16 |
+
const common_1 = require("@nestjs/common");
|
| 17 |
+
const scores_service_1 = require("./scores.service");
|
| 18 |
+
const swagger_1 = require("@nestjs/swagger");
|
| 19 |
+
const create_score_dto_1 = require("./dto/create-score.dto");
|
| 20 |
+
const score_entity_1 = require("./entities/score.entity");
|
| 21 |
+
const measure_entity_1 = require("./entities/measure.entity");
|
| 22 |
+
const pagination_1 = require("./dto/pagination");
|
| 23 |
+
let ScoresController = class ScoresController {
|
| 24 |
+
constructor(scoresService) {
|
| 25 |
+
this.scoresService = scoresService;
|
| 26 |
+
}
|
| 27 |
+
upsertScore(scoreId, createMeasureDto) {
|
| 28 |
+
return this.scoresService.upsertScore(Object.assign({ id: scoreId }, createMeasureDto));
|
| 29 |
+
}
|
| 30 |
+
upsertMeasure(scoreId, index, cluster) {
|
| 31 |
+
return this.scoresService.upsertMeasure({
|
| 32 |
+
scoreId,
|
| 33 |
+
index,
|
| 34 |
+
cluster,
|
| 35 |
+
});
|
| 36 |
+
}
|
| 37 |
+
allScore(query) {
|
| 38 |
+
return this.scoresService.allScore(query);
|
| 39 |
+
}
|
| 40 |
+
findOneScore(scoreId) {
|
| 41 |
+
return this.scoresService.findOneScore(scoreId);
|
| 42 |
+
}
|
| 43 |
+
findOneMeasure(scoreId, index) {
|
| 44 |
+
return this.scoresService.findOneMeasure(scoreId, index);
|
| 45 |
+
}
|
| 46 |
+
removeScore(scoreId) {
|
| 47 |
+
return this.scoresService.removeScore(scoreId);
|
| 48 |
+
}
|
| 49 |
+
removeMeasure(scoreId, index) {
|
| 50 |
+
return this.scoresService.removeMeasure(scoreId, index);
|
| 51 |
+
}
|
| 52 |
+
};
|
| 53 |
+
__decorate([
|
| 54 |
+
(0, swagger_1.ApiBody)({
|
| 55 |
+
schema: {
|
| 56 |
+
type: 'object',
|
| 57 |
+
properties: {
|
| 58 |
+
name: { type: 'string' },
|
| 59 |
+
measures: {
|
| 60 |
+
type: 'array',
|
| 61 |
+
items: {
|
| 62 |
+
type: 'object',
|
| 63 |
+
properties: {
|
| 64 |
+
index: {
|
| 65 |
+
type: 'string',
|
| 66 |
+
},
|
| 67 |
+
cluster: {
|
| 68 |
+
type: 'object',
|
| 69 |
+
},
|
| 70 |
+
},
|
| 71 |
+
},
|
| 72 |
+
},
|
| 73 |
+
},
|
| 74 |
+
},
|
| 75 |
+
}),
|
| 76 |
+
(0, swagger_1.ApiCreatedResponse)({ description: 'The record has been successfully created.' }),
|
| 77 |
+
(0, common_1.Post)(':scoreId'),
|
| 78 |
+
__param(0, (0, common_1.Param)('scoreId')),
|
| 79 |
+
__param(1, (0, common_1.Body)()),
|
| 80 |
+
__metadata("design:type", Function),
|
| 81 |
+
__metadata("design:paramtypes", [String, create_score_dto_1.CreateScoreDto]),
|
| 82 |
+
__metadata("design:returntype", void 0)
|
| 83 |
+
], ScoresController.prototype, "upsertScore", null);
|
| 84 |
+
__decorate([
|
| 85 |
+
(0, swagger_1.ApiBody)({
|
| 86 |
+
schema: {
|
| 87 |
+
type: 'object',
|
| 88 |
+
},
|
| 89 |
+
}),
|
| 90 |
+
(0, swagger_1.ApiCreatedResponse)({ description: 'The record has been successfully created.' }),
|
| 91 |
+
(0, common_1.Post)(':scoreId/measure/:index'),
|
| 92 |
+
__param(0, (0, common_1.Param)('scoreId')),
|
| 93 |
+
__param(1, (0, common_1.Param)('index')),
|
| 94 |
+
__param(2, (0, common_1.Body)()),
|
| 95 |
+
__metadata("design:type", Function),
|
| 96 |
+
__metadata("design:paramtypes", [String, String, Object]),
|
| 97 |
+
__metadata("design:returntype", void 0)
|
| 98 |
+
], ScoresController.prototype, "upsertMeasure", null);
|
| 99 |
+
__decorate([
|
| 100 |
+
(0, swagger_1.ApiResponse)({
|
| 101 |
+
type: [score_entity_1.ScoreEntity],
|
| 102 |
+
}),
|
| 103 |
+
(0, common_1.Get)(),
|
| 104 |
+
__param(0, (0, common_1.Query)()),
|
| 105 |
+
__metadata("design:type", Function),
|
| 106 |
+
__metadata("design:paramtypes", [pagination_1.Pagination]),
|
| 107 |
+
__metadata("design:returntype", void 0)
|
| 108 |
+
], ScoresController.prototype, "allScore", null);
|
| 109 |
+
__decorate([
|
| 110 |
+
(0, swagger_1.ApiResponse)({
|
| 111 |
+
type: score_entity_1.ScoreEntity,
|
| 112 |
+
}),
|
| 113 |
+
(0, common_1.Get)(':scoreId'),
|
| 114 |
+
__param(0, (0, common_1.Param)('scoreId')),
|
| 115 |
+
__metadata("design:type", Function),
|
| 116 |
+
__metadata("design:paramtypes", [String]),
|
| 117 |
+
__metadata("design:returntype", void 0)
|
| 118 |
+
], ScoresController.prototype, "findOneScore", null);
|
| 119 |
+
__decorate([
|
| 120 |
+
(0, swagger_1.ApiResponse)({
|
| 121 |
+
type: measure_entity_1.MeasureEntity,
|
| 122 |
+
}),
|
| 123 |
+
(0, common_1.Get)(':scoreId/measure/:index'),
|
| 124 |
+
__param(0, (0, common_1.Param)('scoreId')),
|
| 125 |
+
__param(1, (0, common_1.Param)('index')),
|
| 126 |
+
__metadata("design:type", Function),
|
| 127 |
+
__metadata("design:paramtypes", [String, String]),
|
| 128 |
+
__metadata("design:returntype", void 0)
|
| 129 |
+
], ScoresController.prototype, "findOneMeasure", null);
|
| 130 |
+
__decorate([
|
| 131 |
+
(0, common_1.Delete)(':scoreId'),
|
| 132 |
+
__param(0, (0, common_1.Param)('scoreId')),
|
| 133 |
+
__metadata("design:type", Function),
|
| 134 |
+
__metadata("design:paramtypes", [String]),
|
| 135 |
+
__metadata("design:returntype", void 0)
|
| 136 |
+
], ScoresController.prototype, "removeScore", null);
|
| 137 |
+
__decorate([
|
| 138 |
+
(0, common_1.Delete)(':scoreId/measure/:index'),
|
| 139 |
+
__param(0, (0, common_1.Param)('scoreId')),
|
| 140 |
+
__param(1, (0, common_1.Param)('index')),
|
| 141 |
+
__metadata("design:type", Function),
|
| 142 |
+
__metadata("design:paramtypes", [String, String]),
|
| 143 |
+
__metadata("design:returntype", void 0)
|
| 144 |
+
], ScoresController.prototype, "removeMeasure", null);
|
| 145 |
+
ScoresController = __decorate([
|
| 146 |
+
(0, swagger_1.ApiTags)('Cluster'),
|
| 147 |
+
(0, common_1.Controller)('score'),
|
| 148 |
+
__metadata("design:paramtypes", [scores_service_1.ScoresService])
|
| 149 |
+
], ScoresController);
|
| 150 |
+
exports.ScoresController = ScoresController;
|
| 151 |
+
//# sourceMappingURL=scores.controller.js.map
|
backend/cluster-server/dist/src/scores/scores.controller.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"scores.controller.js","sourceRoot":"","sources":["../../../src/scores/scores.controller.ts"],"names":[],"mappings":"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"}
|
backend/cluster-server/dist/src/scores/scores.module.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export declare class ScoresModule {
|
| 2 |
+
}
|
backend/cluster-server/dist/src/scores/scores.module.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
| 3 |
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
| 4 |
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
| 5 |
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
| 6 |
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
| 7 |
+
};
|
| 8 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 9 |
+
exports.ScoresModule = void 0;
|
| 10 |
+
const common_1 = require("@nestjs/common");
|
| 11 |
+
const scores_service_1 = require("./scores.service");
|
| 12 |
+
const scores_controller_1 = require("./scores.controller");
|
| 13 |
+
const nestjs_1 = require("@mikro-orm/nestjs");
|
| 14 |
+
const measure_entity_1 = require("./entities/measure.entity");
|
| 15 |
+
const score_entity_1 = require("./entities/score.entity");
|
| 16 |
+
let ScoresModule = class ScoresModule {
|
| 17 |
+
};
|
| 18 |
+
ScoresModule = __decorate([
|
| 19 |
+
(0, common_1.Module)({
|
| 20 |
+
imports: [nestjs_1.MikroOrmModule.forFeature([score_entity_1.ScoreEntity, measure_entity_1.MeasureEntity])],
|
| 21 |
+
controllers: [scores_controller_1.ScoresController],
|
| 22 |
+
providers: [scores_service_1.ScoresService],
|
| 23 |
+
})
|
| 24 |
+
], ScoresModule);
|
| 25 |
+
exports.ScoresModule = ScoresModule;
|
| 26 |
+
//# sourceMappingURL=scores.module.js.map
|
backend/cluster-server/dist/src/scores/scores.module.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"scores.module.js","sourceRoot":"","sources":["../../../src/scores/scores.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,qDAAiD;AACjD,2DAAuD;AACvD,8CAAmD;AACnD,8DAA0D;AAC1D,0DAAsD;AAO/C,IAAM,YAAY,GAAlB,MAAM,YAAY;CAAG,CAAA;AAAf,YAAY;IALxB,IAAA,eAAM,EAAC;QACP,OAAO,EAAE,CAAC,uBAAc,CAAC,UAAU,CAAC,CAAC,0BAAW,EAAE,8BAAa,CAAC,CAAC,CAAC;QAClE,WAAW,EAAE,CAAC,oCAAgB,CAAC;QAC/B,SAAS,EAAE,CAAC,8BAAa,CAAC;KAC1B,CAAC;GACW,YAAY,CAAG;AAAf,oCAAY"}
|
backend/cluster-server/dist/src/scores/scores.service.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { CreateMeasureDto } from './dto/create-measure.dto';
|
| 2 |
+
import { MeasureEntity } from './entities/measure.entity';
|
| 3 |
+
import { EntityRepository } from '@mikro-orm/sqlite';
|
| 4 |
+
import { ScoreEntity } from './entities/score.entity';
|
| 5 |
+
import { CreateScoreDto } from './dto/create-score.dto';
|
| 6 |
+
export declare class ScoresService {
|
| 7 |
+
private readonly measureEntitySqlEntityRepository;
|
| 8 |
+
private readonly scoreEntitySqlEntityRepository;
|
| 9 |
+
constructor(measureEntitySqlEntityRepository: EntityRepository<MeasureEntity>, scoreEntitySqlEntityRepository: EntityRepository<ScoreEntity>);
|
| 10 |
+
upsertScore(createScoreDto: CreateScoreDto): Promise<import("@mikro-orm/core").Loaded<ScoreEntity, never>>;
|
| 11 |
+
upsertMeasure(createMeasureDto: CreateMeasureDto): Promise<import("@mikro-orm/core").Loaded<MeasureEntity, never>>;
|
| 12 |
+
allScore({ offset, limit }?: {
|
| 13 |
+
offset?: number;
|
| 14 |
+
limit?: number;
|
| 15 |
+
}): Promise<{
|
| 16 |
+
data: import("@mikro-orm/core").Loaded<ScoreEntity, never>[];
|
| 17 |
+
total: number;
|
| 18 |
+
}>;
|
| 19 |
+
findOneScore(scoreId: string): Promise<import("@mikro-orm/core").Loaded<ScoreEntity, never>>;
|
| 20 |
+
findOneMeasure(scoreId: string, index: string): Promise<import("@mikro-orm/core").Loaded<MeasureEntity, never>>;
|
| 21 |
+
removeScore(scoreId: string): Promise<string>;
|
| 22 |
+
removeMeasure(scoreId: string, index: string): Promise<string>;
|
| 23 |
+
}
|
backend/cluster-server/dist/src/scores/scores.service.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
| 3 |
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
| 4 |
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
| 5 |
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
| 6 |
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
| 7 |
+
};
|
| 8 |
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
| 9 |
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
| 10 |
+
};
|
| 11 |
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
| 12 |
+
return function (target, key) { decorator(target, key, paramIndex); }
|
| 13 |
+
};
|
| 14 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 15 |
+
exports.ScoresService = void 0;
|
| 16 |
+
const common_1 = require("@nestjs/common");
|
| 17 |
+
const measure_entity_1 = require("./entities/measure.entity");
|
| 18 |
+
const sqlite_1 = require("@mikro-orm/sqlite");
|
| 19 |
+
const nestjs_1 = require("@mikro-orm/nestjs");
|
| 20 |
+
const score_entity_1 = require("./entities/score.entity");
|
| 21 |
+
const core_1 = require("@mikro-orm/core");
|
| 22 |
+
let ScoresService = class ScoresService {
|
| 23 |
+
constructor(measureEntitySqlEntityRepository, scoreEntitySqlEntityRepository) {
|
| 24 |
+
this.measureEntitySqlEntityRepository = measureEntitySqlEntityRepository;
|
| 25 |
+
this.scoreEntitySqlEntityRepository = scoreEntitySqlEntityRepository;
|
| 26 |
+
}
|
| 27 |
+
async upsertScore(createScoreDto) {
|
| 28 |
+
let score = await this.scoreEntitySqlEntityRepository.findOne({ id: createScoreDto.id }, { populate: true });
|
| 29 |
+
if (!score) {
|
| 30 |
+
score = await this.scoreEntitySqlEntityRepository.create({ id: createScoreDto.id, name: createScoreDto.name });
|
| 31 |
+
}
|
| 32 |
+
score.measures.removeAll();
|
| 33 |
+
score.measures.add(...createScoreDto.measures.map((x) => this.measureEntitySqlEntityRepository.create(x)));
|
| 34 |
+
await this.scoreEntitySqlEntityRepository.persistAndFlush(score);
|
| 35 |
+
return score;
|
| 36 |
+
}
|
| 37 |
+
async upsertMeasure(createMeasureDto) {
|
| 38 |
+
let measure = await this.measureEntitySqlEntityRepository.findOne({ score: createMeasureDto.scoreId, index: createMeasureDto.index });
|
| 39 |
+
if (!measure) {
|
| 40 |
+
let score = await this.scoreEntitySqlEntityRepository.findOne({ id: createMeasureDto.scoreId });
|
| 41 |
+
if (!score) {
|
| 42 |
+
score = this.scoreEntitySqlEntityRepository.create({ id: createMeasureDto.scoreId });
|
| 43 |
+
}
|
| 44 |
+
measure = this.measureEntitySqlEntityRepository.create({ score, index: createMeasureDto.index, cluster: createMeasureDto.cluster });
|
| 45 |
+
score.measures.add(measure);
|
| 46 |
+
await this.scoreEntitySqlEntityRepository.persistAndFlush(score);
|
| 47 |
+
}
|
| 48 |
+
else {
|
| 49 |
+
measure.cluster = createMeasureDto.cluster;
|
| 50 |
+
await this.measureEntitySqlEntityRepository.persistAndFlush(measure);
|
| 51 |
+
}
|
| 52 |
+
return measure;
|
| 53 |
+
}
|
| 54 |
+
async allScore({ offset = 0, limit = 1000 } = {}) {
|
| 55 |
+
const [data, total] = await this.scoreEntitySqlEntityRepository.findAndCount({}, {
|
| 56 |
+
orderBy: { createdAt: core_1.QueryOrder.ASC },
|
| 57 |
+
offset: +offset,
|
| 58 |
+
limit: +limit,
|
| 59 |
+
});
|
| 60 |
+
return { data, total };
|
| 61 |
+
}
|
| 62 |
+
async findOneScore(scoreId) {
|
| 63 |
+
return this.scoreEntitySqlEntityRepository.findOne({ id: scoreId }, { populate: true });
|
| 64 |
+
}
|
| 65 |
+
async findOneMeasure(scoreId, index) {
|
| 66 |
+
return await this.measureEntitySqlEntityRepository.findOne({ score: { id: scoreId }, index });
|
| 67 |
+
}
|
| 68 |
+
async removeScore(scoreId) {
|
| 69 |
+
await this.scoreEntitySqlEntityRepository.nativeDelete({ id: scoreId });
|
| 70 |
+
return scoreId;
|
| 71 |
+
}
|
| 72 |
+
async removeMeasure(scoreId, index) {
|
| 73 |
+
await this.measureEntitySqlEntityRepository.nativeDelete({ score: { id: scoreId }, index });
|
| 74 |
+
return index;
|
| 75 |
+
}
|
| 76 |
+
};
|
| 77 |
+
ScoresService = __decorate([
|
| 78 |
+
(0, common_1.Injectable)(),
|
| 79 |
+
__param(0, (0, nestjs_1.InjectRepository)(measure_entity_1.MeasureEntity)),
|
| 80 |
+
__param(1, (0, nestjs_1.InjectRepository)(score_entity_1.ScoreEntity)),
|
| 81 |
+
__metadata("design:paramtypes", [sqlite_1.EntityRepository,
|
| 82 |
+
sqlite_1.EntityRepository])
|
| 83 |
+
], ScoresService);
|
| 84 |
+
exports.ScoresService = ScoresService;
|
| 85 |
+
//# sourceMappingURL=scores.service.js.map
|
backend/cluster-server/dist/src/scores/scores.service.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"scores.service.js","sourceRoot":"","sources":["../../../src/scores/scores.service.ts"],"names":[],"mappings":"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"}
|
backend/cluster-server/dist/src/shared/interceptor/transform.interceptor.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { CallHandler, ExecutionContext, NestInterceptor } from '@nestjs/common';
|
| 2 |
+
import { Observable } from 'rxjs';
|
| 3 |
+
interface Response<T> {
|
| 4 |
+
data: T;
|
| 5 |
+
}
|
| 6 |
+
export declare class TransformInterceptor<T> implements NestInterceptor<T, Response<T>> {
|
| 7 |
+
intercept(context: ExecutionContext, next: CallHandler<T>): Observable<any>;
|
| 8 |
+
}
|
| 9 |
+
export {};
|