model filling
This commit is contained in:
parent
c27c061c15
commit
6ca82f8c2e
29 changed files with 245 additions and 132 deletions
1
server/.gitignore
vendored
1
server/.gitignore
vendored
|
@ -7,3 +7,4 @@ coverage
|
||||||
package-lock.json
|
package-lock.json
|
||||||
.*.swp
|
.*.swp
|
||||||
build/
|
build/
|
||||||
|
model_create.ts
|
|
@ -40,6 +40,7 @@
|
||||||
"first-di": "^1.0.11",
|
"first-di": "^1.0.11",
|
||||||
"md5": "^2.3.0",
|
"md5": "^2.3.0",
|
||||||
"mongoose": "^7.6.2",
|
"mongoose": "^7.6.2",
|
||||||
|
"mongoose-autopopulate": "^1.1.0",
|
||||||
"node-watch": "^0.7.4",
|
"node-watch": "^0.7.4",
|
||||||
"nodemon": "^3.0.1",
|
"nodemon": "^3.0.1",
|
||||||
"reflect-metadata": "^0.1.13",
|
"reflect-metadata": "^0.1.13",
|
||||||
|
|
|
@ -5,7 +5,7 @@ import locator from "../di/register_di";
|
||||||
import { DevEnv, UnitTestEnv } from "../di/env";
|
import { DevEnv, UnitTestEnv } from "../di/env";
|
||||||
import mongoose from "mongoose";
|
import mongoose from "mongoose";
|
||||||
import http from "http";
|
import http from "http";
|
||||||
import { Server } from "socket.io";
|
// import { Server } from "socket.io";
|
||||||
|
|
||||||
export class App {
|
export class App {
|
||||||
public app: express.Application;
|
public app: express.Application;
|
||||||
|
@ -14,13 +14,14 @@ export class App {
|
||||||
public computedFolder: string;
|
public computedFolder: string;
|
||||||
// public io:
|
// public io:
|
||||||
constructor(routes: Routes[], computedFolder: string) {
|
constructor(routes: Routes[], computedFolder: string) {
|
||||||
this.app = express();
|
this.port = 3000;
|
||||||
this.port = Number(process.env.PORT) || 3000;
|
|
||||||
this.env = "dev";
|
this.env = "dev";
|
||||||
|
this.loadAppDependencies().then(() => {
|
||||||
|
this.app = express();
|
||||||
this.initializeMiddlewares();
|
this.initializeMiddlewares();
|
||||||
this.initializeRoutes(routes);
|
this.initializeRoutes(routes);
|
||||||
this.loadAppDependencies();
|
|
||||||
this.computedFolder = computedFolder;
|
this.computedFolder = computedFolder;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public listen() {
|
public listen() {
|
||||||
|
@ -28,6 +29,7 @@ export class App {
|
||||||
// const io = new Server(httpServer);
|
// const io = new Server(httpServer);
|
||||||
|
|
||||||
httpServer.listen(this.port, () => {
|
httpServer.listen(this.port, () => {
|
||||||
|
console.log(this.port);
|
||||||
console.info(`=================================`);
|
console.info(`=================================`);
|
||||||
console.info(`======= ENV: ${this.env} =======`);
|
console.info(`======= ENV: ${this.env} =======`);
|
||||||
console.info(`🚀 HTTP http://localhost:${this.port}`);
|
console.info(`🚀 HTTP http://localhost:${this.port}`);
|
||||||
|
@ -44,7 +46,6 @@ export class App {
|
||||||
// io.emit("goodbye");
|
// io.emit("goodbye");
|
||||||
// console.log(200);
|
// console.log(200);
|
||||||
// }, 1000);
|
// }, 1000);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public getServer() {
|
public getServer() {
|
||||||
|
@ -62,8 +63,8 @@ export class App {
|
||||||
this.app.use("/", route.router);
|
this.app.use("/", route.router);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
loadAppDependencies() {
|
async loadAppDependencies() {
|
||||||
locator(
|
await locator(
|
||||||
this.env == "development"
|
this.env == "development"
|
||||||
? new DevEnv(this.computedFolder)
|
? new DevEnv(this.computedFolder)
|
||||||
: new UnitTestEnv(this.computedFolder)
|
: new UnitTestEnv(this.computedFolder)
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
|
import { Service } from "typedi";
|
||||||
|
|
||||||
|
@Service()
|
||||||
export class IEnv{
|
export class IEnv{
|
||||||
rootFolder!: string;
|
rootFolder!: string;
|
||||||
constructor(){
|
constructor(){
|
||||||
|
@ -12,6 +14,7 @@ export class IEnv{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Service()
|
||||||
export class DevEnv implements IEnv {
|
export class DevEnv implements IEnv {
|
||||||
rootFolder:string;
|
rootFolder:string;
|
||||||
constructor(rootFolder:string){
|
constructor(rootFolder:string){
|
||||||
|
@ -25,7 +28,7 @@ export class IEnv{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@Service()
|
||||||
export class UnitTestEnv implements IEnv{
|
export class UnitTestEnv implements IEnv{
|
||||||
rootFolder:string;
|
rootFolder:string;
|
||||||
constructor(rootFolder:string){
|
constructor(rootFolder:string){
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// import { override } from "first-di";
|
|
||||||
import { DevEnv, IEnv, UnitTestEnv } from "./env";
|
import { DevEnv, IEnv, UnitTestEnv } from "./env";
|
||||||
import { MetaDataFileManagerModel } from "../model/meta_data_file_manager_model";
|
|
||||||
import { extensions } from "../extensions/extensions";
|
import { extensions } from "../extensions/extensions";
|
||||||
|
import { Container, Service } from 'typedi';
|
||||||
|
|
||||||
export default function locator(env: IEnv) {
|
export default function locator(env: IEnv) {
|
||||||
extensions();
|
extensions();
|
||||||
|
|
|
@ -3,3 +3,4 @@ import { ArrayEquals } from "./array";
|
||||||
export const extensions = () =>{
|
export const extensions = () =>{
|
||||||
ArrayEquals()
|
ArrayEquals()
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@ import { Trigger } from "../../features/triggers/trigger_model";
|
||||||
import { EXEC_TYPE } from "./exec_error_model";
|
import { EXEC_TYPE } from "./exec_error_model";
|
||||||
|
|
||||||
|
|
||||||
export interface ProcessMetaData {
|
export interface IPipeline {
|
||||||
process: Process;
|
process: IProcess;
|
||||||
trigger: Trigger;
|
trigger: Trigger;
|
||||||
env: Env | null;
|
env: Env | null;
|
||||||
stackGenerateType:StackGenerateType;
|
stackGenerateType:StackGenerateType;
|
||||||
|
@ -20,7 +20,7 @@ export interface Env {
|
||||||
isExtends: string;
|
isExtends: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Process {
|
export interface IProcess {
|
||||||
type: EXEC_TYPE;
|
type: EXEC_TYPE;
|
||||||
command: string;
|
command: string;
|
||||||
isGenerating: boolean;
|
isGenerating: boolean;
|
||||||
|
|
|
@ -2,7 +2,7 @@ import {
|
||||||
FilesChangeNotifierService,
|
FilesChangeNotifierService,
|
||||||
IHashesCache,
|
IHashesCache,
|
||||||
} from "./files_change_notifier_service";
|
} from "./files_change_notifier_service";
|
||||||
import { ProcessMetaData } from "../model/process_model";
|
import { IPipeline } from "../model/process_model";
|
||||||
import { ExecutorProgramService } from "./executor_program_service";
|
import { ExecutorProgramService } from "./executor_program_service";
|
||||||
import {
|
import {
|
||||||
EXEC_EVENT,
|
EXEC_EVENT,
|
||||||
|
@ -18,27 +18,27 @@ import { Trigger } from "../../features/triggers/trigger_model";
|
||||||
|
|
||||||
export interface Iteration {
|
export interface Iteration {
|
||||||
hashes: IHashesCache | null;
|
hashes: IHashesCache | null;
|
||||||
process: ProcessMetaData;
|
process: IPipeline;
|
||||||
result?: ExecError | SpawnError | ExecutorResult;
|
result?: ExecError | SpawnError | ExecutorResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
export abstract class IStackService {
|
export abstract class IStackService {
|
||||||
abstract callStack: Iteration[];
|
abstract callStack: Iteration[];
|
||||||
abstract path: string;
|
abstract path: string;
|
||||||
abstract init(processed: ProcessMetaData[], path: string): void;
|
abstract init(processed: IPipeline[], path: string): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class StackService extends TypedEvent<string> implements IStackService {
|
export class StackService extends TypedEvent<string> implements IStackService {
|
||||||
callStack: Iteration[];
|
callStack: Iteration[];
|
||||||
path: string;
|
path: string;
|
||||||
constructor(processed: ProcessMetaData[], path: string) {
|
constructor(processed: IPipeline[], path: string) {
|
||||||
super();
|
super();
|
||||||
this.path = path;
|
this.path = path;
|
||||||
this.callStack = [];
|
this.callStack = [];
|
||||||
this.init(processed);
|
this.init(processed);
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(processed: ProcessMetaData[]) {
|
public init(processed: IPipeline[]) {
|
||||||
for (let el of processed) {
|
for (let el of processed) {
|
||||||
el = this.commandHandler(el);
|
el = this.commandHandler(el);
|
||||||
this.callStack.push({
|
this.callStack.push({
|
||||||
|
@ -47,7 +47,7 @@ export class StackService extends TypedEvent<string> implements IStackService {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private commandHandler(processMetaData: ProcessMetaData) {
|
private commandHandler(processMetaData: IPipeline) {
|
||||||
processMetaData.process.command = processMetaData.process.command.replace(
|
processMetaData.process.command = processMetaData.process.command.replace(
|
||||||
"$PATH",
|
"$PATH",
|
||||||
this.path
|
this.path
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
import { IsArray, IsString, IsOptional } from "class-validator";
|
|
||||||
import { Schema, model } from "mongoose";
|
|
||||||
|
|
||||||
export interface ICompositionModel {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export const CompositionSchema = new Schema({
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
const schema = "Composition";
|
|
||||||
|
|
||||||
export const CompositionDBModel = model<ICompositionModel>(schema, CompositionSchema);
|
|
||||||
|
|
||||||
export class CompositionModel implements ICompositionModel {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
import { CrudController } from "../../core/controllers/crud_controller";
|
|
||||||
import { CompositionDBModel, CompositionModel } from "./composition_model";
|
|
||||||
|
|
||||||
export class CompositionPresentation extends CrudController<
|
|
||||||
CompositionModel,
|
|
||||||
typeof CompositionDBModel
|
|
||||||
> {
|
|
||||||
constructor() {
|
|
||||||
super({
|
|
||||||
url: "compositions",
|
|
||||||
validationModel: CompositionModel,
|
|
||||||
databaseModel: CompositionDBModel,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
import { IsArray, IsString, IsOptional } from "class-validator";
|
|
||||||
import { Schema, model } from "mongoose";
|
|
||||||
|
|
||||||
export interface IFunctionsModel {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export const FunctionsSchema = new Schema({
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
const schema = "Functions";
|
|
||||||
|
|
||||||
export const FunctionsDBModel = model<IFunctionsModel>(schema, FunctionsSchema);
|
|
||||||
|
|
||||||
export class FunctionsModel implements IFunctionsModel {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
import { CrudController } from "../../core/controllers/crud_controller";
|
|
||||||
import { FunctionsDBModel, FunctionsModel } from "./functions_model";
|
|
||||||
|
|
||||||
export class FunctionsPresentation extends CrudController<
|
|
||||||
FunctionsModel,
|
|
||||||
typeof FunctionsDBModel
|
|
||||||
> {
|
|
||||||
constructor() {
|
|
||||||
super({
|
|
||||||
url: "functions",
|
|
||||||
validationModel: FunctionsModel,
|
|
||||||
databaseModel: FunctionsDBModel,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
47
server/src/features/pipelines/pipeline_model.ts
Normal file
47
server/src/features/pipelines/pipeline_model.ts
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
import { IsMongoId, IsEnum } from "class-validator";
|
||||||
|
import { Schema, model } from "mongoose";
|
||||||
|
import { StackGenerateType } from "../../core/model/process_model";
|
||||||
|
import {
|
||||||
|
TriggerModel,
|
||||||
|
triggerSchema,
|
||||||
|
} from "../triggers/trigger_model";
|
||||||
|
import { schemaProcess } from "../process/process_model";
|
||||||
|
|
||||||
|
export const PipelineSchema = new Schema({
|
||||||
|
process: {
|
||||||
|
type: Schema.Types.ObjectId,
|
||||||
|
ref: schemaProcess,
|
||||||
|
autopopulate: true,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
trigger: {
|
||||||
|
type: Schema.Types.ObjectId,
|
||||||
|
ref: triggerSchema,
|
||||||
|
autopopulate: true,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
command: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
}).plugin(require("mongoose-autopopulate"));
|
||||||
|
|
||||||
|
export const schemaPipeline = "Pipeline";
|
||||||
|
|
||||||
|
export const PipelineDBModel = model<PipelineModel>(
|
||||||
|
schemaPipeline,
|
||||||
|
PipelineSchema
|
||||||
|
);
|
||||||
|
|
||||||
|
export class PipelineModel {
|
||||||
|
@IsMongoId()
|
||||||
|
public process: PipelineModel;
|
||||||
|
|
||||||
|
@IsMongoId()
|
||||||
|
//TODO(IDONTSUDO):NEED OPTION DECORATOR??
|
||||||
|
public trigger: TriggerModel;
|
||||||
|
|
||||||
|
public env = null;
|
||||||
|
|
||||||
|
@IsEnum(StackGenerateType)
|
||||||
|
public stackGenerateType: StackGenerateType;
|
||||||
|
}
|
16
server/src/features/pipelines/pipeline_presentation.ts
Normal file
16
server/src/features/pipelines/pipeline_presentation.ts
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
import { CrudController } from "../../core/controllers/crud_controller";
|
||||||
|
import { PipelineDBModel, PipelineModel } from "./pipeline_model";
|
||||||
|
|
||||||
|
export class PipelinePresentation extends CrudController<
|
||||||
|
PipelineModel,
|
||||||
|
typeof PipelineDBModel
|
||||||
|
> {
|
||||||
|
constructor() {
|
||||||
|
super({
|
||||||
|
url: "pipeline",
|
||||||
|
validationModel: PipelineModel,
|
||||||
|
databaseModel: PipelineDBModel,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
74
server/src/features/process/process_model.ts
Normal file
74
server/src/features/process/process_model.ts
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
import {
|
||||||
|
IsString,
|
||||||
|
IsOptional,
|
||||||
|
ValidateNested,
|
||||||
|
IsEnum,
|
||||||
|
IsMongoId,
|
||||||
|
IsNumber,
|
||||||
|
IsBoolean,
|
||||||
|
} from "class-validator";
|
||||||
|
import { ObjectId, Schema, model } from "mongoose";
|
||||||
|
import {
|
||||||
|
IProcess,
|
||||||
|
IPipeline,
|
||||||
|
IssueType,
|
||||||
|
StackGenerateType,
|
||||||
|
} from "../../core/model/process_model";
|
||||||
|
import { Type } from "class-transformer";
|
||||||
|
import { EXEC_TYPE } from "../../core/model/exec_error_model";
|
||||||
|
|
||||||
|
export const ProcessSchema = new Schema({
|
||||||
|
type: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
command: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
isGenerating: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
isLocaleCode: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
issueType: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
timeout: {
|
||||||
|
type: Number,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
commit: {
|
||||||
|
type: String,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export const schemaProcess = "Process";
|
||||||
|
|
||||||
|
export const ProcessDBModel = model<IProcess>(schemaProcess, ProcessSchema);
|
||||||
|
|
||||||
|
export class ProcessModel implements IProcess {
|
||||||
|
@IsEnum(EXEC_TYPE)
|
||||||
|
public type: EXEC_TYPE;
|
||||||
|
|
||||||
|
@IsString()
|
||||||
|
public command: string;
|
||||||
|
|
||||||
|
@IsBoolean()
|
||||||
|
public isGenerating: boolean;
|
||||||
|
|
||||||
|
@IsBoolean()
|
||||||
|
public isLocaleCode: boolean;
|
||||||
|
|
||||||
|
@IsEnum(IssueType)
|
||||||
|
public issueType: IssueType;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsNumber()
|
||||||
|
public timeout?: number;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
|
public commit?: string;
|
||||||
|
}
|
||||||
|
|
15
server/src/features/process/process_presentation.ts
Normal file
15
server/src/features/process/process_presentation.ts
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
import { CrudController } from "../../core/controllers/crud_controller";
|
||||||
|
import { ProcessDBModel, ProcessModel } from "./process_model";
|
||||||
|
|
||||||
|
export class ProcessPresentation extends CrudController<
|
||||||
|
ProcessModel,
|
||||||
|
typeof ProcessDBModel
|
||||||
|
> {
|
||||||
|
constructor() {
|
||||||
|
super({
|
||||||
|
url: "process",
|
||||||
|
validationModel: ProcessModel,
|
||||||
|
databaseModel: ProcessDBModel,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,14 +1,42 @@
|
||||||
import { IsArray, IsString, IsOptional } from "class-validator";
|
import mongoose, { Schema, model } from "mongoose";
|
||||||
import { Schema, model } from "mongoose";
|
import { PipelineModel, schemaPipeline } from "../pipelines/pipeline_model";
|
||||||
|
|
||||||
|
export interface IProjectModel {
|
||||||
|
pipelines: [PipelineModel];
|
||||||
|
rootDir: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface IProjectModel {}
|
|
||||||
|
|
||||||
export const ProjectSchema = new Schema({
|
export const ProjectSchema = new Schema({
|
||||||
|
pipelines: {
|
||||||
});
|
type: Array<Schema.Types.ObjectId>,
|
||||||
|
ref: schemaPipeline,
|
||||||
|
autopopulate: true,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
rootDir: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
}).plugin(require("mongoose-autopopulate"));
|
||||||
|
|
||||||
const schema = "Projects";
|
const schema = "Projects";
|
||||||
|
|
||||||
export const ProjectDBModel = model<IProjectModel>(schema, ProjectSchema);
|
export const ProjectDBModel = model<IProjectModel>(schema, ProjectSchema);
|
||||||
|
|
||||||
export class ProjectModel implements IProjectModel {}
|
export class ProjectModel implements IProjectModel {
|
||||||
|
pipelines: [PipelineModel];
|
||||||
|
rootDir: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// export class ProcessModel implements IProcessMetaData {
|
||||||
|
|
||||||
|
// public process: IProcess;
|
||||||
|
|
||||||
|
// public trigger: ObjectId;
|
||||||
|
|
||||||
|
// // TODO(IDONTSUDO): later, when maintaining many environments, you will need to make a table
|
||||||
|
// public env = null;
|
||||||
|
|
||||||
|
// @IsEnum(StackGenerateType)
|
||||||
|
// public stackGenerateType: StackGenerateType;
|
||||||
|
// }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { IsArray, IsString, IsOptional } from "class-validator";
|
import { IsArray, IsOptional, IsEnum} from "class-validator";
|
||||||
import { Schema, model } from "mongoose";
|
import { Schema, model } from "mongoose";
|
||||||
|
|
||||||
export interface ITriggerModel {
|
export interface ITriggerModel {
|
||||||
|
@ -18,16 +18,20 @@ export const TriggerSchema = new Schema({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const schema = "Trigger";
|
export const triggerSchema = "Trigger";
|
||||||
|
|
||||||
export const TriggerDBModel = model<ITriggerModel>(schema, TriggerSchema);
|
export const TriggerDBModel = model<ITriggerModel>(triggerSchema, TriggerSchema);
|
||||||
|
|
||||||
|
export enum TriggerType {
|
||||||
|
PROCESS = "PROCESS",
|
||||||
|
FILE = "FILE",
|
||||||
|
}
|
||||||
|
|
||||||
export class TriggerModel implements ITriggerModel {
|
export class TriggerModel implements ITriggerModel {
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
public _id: string;
|
public _id: string;
|
||||||
@IsString()
|
@IsEnum(TriggerType)
|
||||||
public type: string;
|
public type: TriggerType;
|
||||||
|
|
||||||
@IsArray()
|
@IsArray()
|
||||||
public value: string[];
|
public value: string[];
|
||||||
}
|
}
|
||||||
|
@ -37,7 +41,3 @@ export interface Trigger {
|
||||||
value: string[];
|
value: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum TriggerType {
|
|
||||||
PROCESS = "PROCESS",
|
|
||||||
FILE = "FILE",
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,21 +1,20 @@
|
||||||
import "reflect-metadata";
|
import "reflect-metadata";
|
||||||
import { App } from "./core/controllers/app";
|
import { App } from "./core/controllers/app";
|
||||||
|
import { Routes } from "./core/interfaces/router";
|
||||||
import { TriggerPresentation } from "./features/triggers/triggers_presentation";
|
import { TriggerPresentation } from "./features/triggers/triggers_presentation";
|
||||||
import { ProjectsPresentation } from "./features/projects/projects_presentation";
|
import { ProjectsPresentation } from "./features/projects/projects_presentation";
|
||||||
import { FunctionsPresentation } from "./features/functions/functions_presentation";
|
import { PipelinePresentation } from "./features/pipelines/pipeline_presentation";
|
||||||
import { CompositionPresentation } from "./features/compositions/compositions_presentation";
|
import { ProcessPresentation } from "./features/process/process_presentation";
|
||||||
import { Routes } from "./core/interfaces/router";
|
|
||||||
|
|
||||||
import { Container, Service } from 'typedi';
|
|
||||||
|
|
||||||
|
|
||||||
const httpRoutes: Routes[] = [
|
const httpRoutes: Routes[] = [
|
||||||
new TriggerPresentation(),
|
new TriggerPresentation(),
|
||||||
new ProjectsPresentation(),
|
new ProjectsPresentation(),
|
||||||
new FunctionsPresentation(),
|
new ProcessPresentation(),
|
||||||
new CompositionPresentation(),
|
new PipelinePresentation(),
|
||||||
].map((el) => el.call());
|
].map((el) => el.call());
|
||||||
|
|
||||||
const computedFolder = "";
|
const computedFolder = "";
|
||||||
|
|
||||||
new App(httpRoutes, computedFolder).listen();
|
new App(httpRoutes, computedFolder).listen();
|
||||||
|
|
|
@ -4,7 +4,6 @@ import * as fs from "fs";
|
||||||
import {
|
import {
|
||||||
IssueType,
|
IssueType,
|
||||||
StackGenerateType,
|
StackGenerateType,
|
||||||
|
|
||||||
} from "../../src/core/model/process_model";
|
} from "../../src/core/model/process_model";
|
||||||
import { EXEC_TYPE } from "../../src/core/model/exec_error_model";
|
import { EXEC_TYPE } from "../../src/core/model/exec_error_model";
|
||||||
import { StackService } from "../../src/core/services/stack_service";
|
import { StackService } from "../../src/core/services/stack_service";
|
|
@ -1,18 +1,17 @@
|
||||||
import { fileURLToPath } from "url";
|
|
||||||
import { TestCore } from "./core/test_core";
|
import { TestCore } from "./core/test_core";
|
||||||
import { UnitTestEnv } from "../src/core/di/env";
|
import { UnitTestEnv } from "../src/core/di/env";
|
||||||
import { dirname } from "path";
|
import { dirname } from "path";
|
||||||
import locator from "../src/core/di/register_di";
|
import locator from "../src/core/di/register_di";
|
||||||
import { ExecutorProgramServiceTest } from "./features/executor_program_service_test";
|
import { ExecutorProgramServiceTest } from "./services/executor_program_service_test";
|
||||||
import { FilesChangerTest } from "./features/files_change_notifier_service_test";
|
import { FilesChangerTest } from "./services/files_change_notifier_service_test";
|
||||||
import { TriggerServiceTest } from "./features/trigger_service_test";
|
import { TriggerServiceTest } from "./services/trigger_service_test";
|
||||||
import { StackServiceTest } from "./features/stack_service_test";
|
import { StackServiceTest } from "./services/stack_service_test";
|
||||||
import mongoose from "mongoose";
|
import mongoose from "mongoose";
|
||||||
import { CreateDataBaseModelUseCaseTest } from "./usecase/create_database_model_usecase_test";
|
import { CreateDataBaseModelUseCaseTest } from "./usecases/create_database_model_usecase_test";
|
||||||
import { DeleteDataBaseModelUseCaseTest } from "./usecase/delete_database_model_usecase_test";
|
import { DeleteDataBaseModelUseCaseTest } from "./usecases/delete_database_model_usecase_test";
|
||||||
import { ReadDataBaseModelUseCaseTest } from "./usecase/read_database_model_usecase_test";
|
import { ReadDataBaseModelUseCaseTest } from "./usecases/read_database_model_usecase_test";
|
||||||
import { UpdateDataBaseModelUseCaseTest } from "./usecase/update_database_model_usecase";
|
import { UpdateDataBaseModelUseCaseTest } from "./usecases/update_database_model_usecase";
|
||||||
import { PaginationDataBaseModelUseCaseTest } from "./usecase/pagination_database_model_usecase_test";
|
import { PaginationDataBaseModelUseCaseTest } from "./usecases/pagination_database_model_usecase_test";
|
||||||
|
|
||||||
|
|
||||||
const testCore = TestCore.instance;
|
const testCore = TestCore.instance;
|
||||||
|
@ -23,6 +22,7 @@ export const resultTest = testCore.resultTest;
|
||||||
const env = new UnitTestEnv(dirname__);
|
const env = new UnitTestEnv(dirname__);
|
||||||
|
|
||||||
locator(env);
|
locator(env);
|
||||||
|
|
||||||
const tests = [CreateDataBaseModelUseCaseTest, DeleteDataBaseModelUseCaseTest,ReadDataBaseModelUseCaseTest,UpdateDataBaseModelUseCaseTest, PaginationDataBaseModelUseCaseTest]
|
const tests = [CreateDataBaseModelUseCaseTest, DeleteDataBaseModelUseCaseTest,ReadDataBaseModelUseCaseTest,UpdateDataBaseModelUseCaseTest, PaginationDataBaseModelUseCaseTest]
|
||||||
const init = async () =>{
|
const init = async () =>{
|
||||||
await mongoose.connect('mongodb://127.0.0.1:27017/test')
|
await mongoose.connect('mongodb://127.0.0.1:27017/test')
|
||||||
|
@ -46,8 +46,6 @@ const test = async () =>{
|
||||||
const main = async () => {
|
const main = async () => {
|
||||||
await init()
|
await init()
|
||||||
await test()
|
await test()
|
||||||
|
|
||||||
|
|
||||||
await testCore.testResult();
|
await testCore.testResult();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue