Skip to content

Instantly share code, notes, and snippets.

import { NestFactory } from '@nestjs/core';
import { config } from 'dotenv';
config();
import { CustomExceptionFilter } from './exeptions/custom-exception.filter';
import { AppModule } from './app/app.module';
import * as compression from 'compression';
import * as express from 'express'
import * as cors from 'cors';
async updateEvent(layerId, eventId, eventInstance) {
try {
if (!layerId) throw new Error('Не задан id слоя');
if (!eventId) throw new Error('Не задан id события');
let schema: any = await Layers.findById(layerId);
if (!schema) throw new Error('Слой не существует');
let eventsTableName = schema.toJSON().layer_schema.eventsTable;
if (!eventsTableName) throw new Error('У слоя нет таблицы событий');
let eventsTable = this.generateEventsModel(schema, eventsTableName);
export class users_layers extends Model<users_layers> {
@AutoIncrement
@PrimaryKey
@Column(DataType.INTEGER)
id: number;
@ForeignKey(() => users)
@Column(DataType.CHAR(100))
@BelongsTo(() => users)
user_id: string;