feat: better server lint (#2850)
* feat: add stylistic eslint plugin * feat: add missing line return * feat: secure line-break style * feat: disallow break before else * feat: line between class members * feat: better new line lint rule
This commit is contained in:
@ -29,6 +29,7 @@ export class DataSeedDemoWorkspaceCommand extends CommandRunner {
|
||||
logging: true,
|
||||
schema: 'public',
|
||||
});
|
||||
|
||||
await dataSource.initialize();
|
||||
const demoWorkspaceIds = this.environmentService.getDemoWorkspaceIds();
|
||||
|
||||
@ -46,6 +47,7 @@ export class DataSeedDemoWorkspaceCommand extends CommandRunner {
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,12 +43,14 @@ export class DataSeedWorkspaceCommand extends CommandRunner {
|
||||
logging: true,
|
||||
schema: 'public',
|
||||
});
|
||||
|
||||
await dataSource.initialize();
|
||||
|
||||
await seedCoreSchema(dataSource, this.workspaceId);
|
||||
await seedMetadataSchema(dataSource);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -18,6 +18,7 @@ export const seedCoreSchema = async (
|
||||
workspaceId: string,
|
||||
) => {
|
||||
const schemaName = 'core';
|
||||
|
||||
await seedWorkspaces(workspaceDataSource, schemaName, workspaceId);
|
||||
await seedUsers(workspaceDataSource, schemaName, workspaceId);
|
||||
await seedFeatureFlags(workspaceDataSource, schemaName, workspaceId);
|
||||
@ -28,6 +29,7 @@ export const deleteCoreSchema = async (
|
||||
workspaceId: string,
|
||||
) => {
|
||||
const schemaName = 'core';
|
||||
|
||||
await deleteUsersByWorkspace(workspaceDataSource, schemaName, workspaceId);
|
||||
await deleteFeatureFlags(workspaceDataSource, schemaName, workspaceId);
|
||||
// deleteWorkspaces should be last
|
||||
|
||||
@ -18,6 +18,7 @@ export const seedCoreSchema = async (
|
||||
workspaceId: string,
|
||||
) => {
|
||||
const schemaName = 'core';
|
||||
|
||||
await seedWorkspaces(workspaceDataSource, schemaName, workspaceId);
|
||||
await seedUsers(workspaceDataSource, schemaName, workspaceId);
|
||||
await seedFeatureFlags(workspaceDataSource, schemaName, workspaceId);
|
||||
@ -28,6 +29,7 @@ export const deleteCoreSchema = async (
|
||||
workspaceId: string,
|
||||
) => {
|
||||
const schemaName = 'core';
|
||||
|
||||
await deleteUsersByWorkspace(workspaceDataSource, schemaName, workspaceId);
|
||||
await deleteFeatureFlags(workspaceDataSource, schemaName, workspaceId);
|
||||
// deleteWorkspaces should be last
|
||||
|
||||
@ -27,6 +27,7 @@ import { seedWebhookFieldMetadata } from 'src/database/typeorm-seeds/metadata/fi
|
||||
|
||||
export const seedMetadataSchema = async (workspaceDataSource: DataSource) => {
|
||||
const schemaName = 'metadata';
|
||||
|
||||
await seedDataSource(workspaceDataSource, schemaName);
|
||||
await seedObjectMetadata(workspaceDataSource, schemaName);
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@ import { DataSource, DataSourceOptions } from 'typeorm';
|
||||
import { config } from 'dotenv';
|
||||
config();
|
||||
const configService = new ConfigService();
|
||||
|
||||
export const typeORMCoreModuleOptions: TypeOrmModuleOptions = {
|
||||
url: configService.get<string>('PG_DATABASE_URL'),
|
||||
type: 'postgres',
|
||||
|
||||
@ -5,6 +5,7 @@ import { DataSource, DataSourceOptions } from 'typeorm';
|
||||
import { config } from 'dotenv';
|
||||
config();
|
||||
const configService = new ConfigService();
|
||||
|
||||
export const typeORMMetadataModuleOptions: TypeOrmModuleOptions = {
|
||||
url: configService.get<string>('PG_DATABASE_URL'),
|
||||
type: 'postgres',
|
||||
|
||||
@ -1,18 +1,29 @@
|
||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class AddEnumOptions1700663879152 implements MigrationInterface {
|
||||
name = 'AddEnumOptions1700663879152'
|
||||
name = 'AddEnumOptions1700663879152';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "metadata"."fieldMetadata" RENAME COLUMN "enums" TO "options"`);
|
||||
await queryRunner.query(`ALTER TABLE "metadata"."fieldMetadata" DROP COLUMN "options"`);
|
||||
await queryRunner.query(`ALTER TABLE "metadata"."fieldMetadata" ADD "options" jsonb`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "metadata"."fieldMetadata" DROP COLUMN "options"`);
|
||||
await queryRunner.query(`ALTER TABLE "metadata"."fieldMetadata" ADD "options" text array`);
|
||||
await queryRunner.query(`ALTER TABLE "metadata"."fieldMetadata" RENAME COLUMN "options" TO "enums"`);
|
||||
}
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "metadata"."fieldMetadata" RENAME COLUMN "enums" TO "options"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "metadata"."fieldMetadata" DROP COLUMN "options"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "metadata"."fieldMetadata" ADD "options" jsonb`,
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "metadata"."fieldMetadata" DROP COLUMN "options"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "metadata"."fieldMetadata" ADD "options" text array`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "metadata"."fieldMetadata" RENAME COLUMN "options" TO "enums"`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user