finish the launch

This commit is contained in:
IDONTSUDO 2023-10-31 09:03:41 +03:00
parent 6ca82f8c2e
commit fbcfba3948
12 changed files with 58 additions and 92 deletions

View file

@ -29,7 +29,6 @@ export class App {
// const io = new Server(httpServer);
httpServer.listen(this.port, () => {
console.log(this.port);
console.info(`=================================`);
console.info(`======= ENV: ${this.env} =======`);
console.info(`🚀 HTTP http://localhost:${this.port}`);
@ -78,3 +77,6 @@ export class App {
});
}
}

View file

@ -3,7 +3,6 @@ import { Result } from "../helper/result";
import { Router, Request, Response } from "express";
import { IRouteModel, Routes } from "../interfaces/router";
export type CallBackFunction<T> = (a: T) => Promise<Result<any, any>>;
abstract class ICoreHttpController {
@ -40,9 +39,7 @@ export class CoreHttpController<V> implements ICoreHttpController {
);
}
if (this.routes["DELETE"] != null) {
this.router.delete(
this.url,
(req, res) =>
this.router.delete(this.url, (req, res) =>
this.requestResponseController<V>(req, res, this.routes["DELETE"])
);
}
@ -75,24 +72,20 @@ export class CoreHttpController<V> implements ICoreHttpController {
res: Response,
usecase: CallBackFunction<T>
) {
let payload = null
let payload = null;
if (req["model"] != undefined) {
payload = req.body as T
payload = req.body as T;
}
if (req.query.page !== undefined) {
payload = String(req.query.page)
payload = String(req.query.page);
}
if (req.query.id !== undefined) {
payload = String(req.query.id)
payload = String(req.query.id);
}
(await usecase(payload)).fold(
(ok) => {
res.json(ok);
@ -112,4 +105,3 @@ export class CoreHttpController<V> implements ICoreHttpController {
this.routes["GET"] = usecase;
}
}

View file

@ -1,15 +1,15 @@
import path from "path";
import { TypedEvent } from "../helper/typed_event";
import { StackService } from "../services/stack_service";
// TODO(IDONTSUDO): up to do
// import path from "path";
// import { TypedEvent } from "../helper/typed_event";
// import { StackService } from "../services/stack_service";
// // TODO(IDONTSUDO): up to do
class SocketController<T>{
emitter:TypedEvent<T>;
constructor(emitter:TypedEvent<T>, ){
this.emitter = emitter
}
call = () =>{
// class SocketController<T>{
// emitter:TypedEvent<T>;
// constructor(emitter:TypedEvent<T>, ){
// this.emitter = emitter
// }
// call = () =>{
}
}
// }
// }

View file

@ -1,6 +1,6 @@
import { DevEnv, IEnv, UnitTestEnv } from "./env";
import { extensions } from "../extensions/extensions";
import { Container, Service } from 'typedi';
// import { Container, Service } from 'typedi';
export default function locator(env: IEnv) {
extensions();

View file

@ -1,6 +1,5 @@
import { EXEC_EVENT, EXEC_TYPE } from "./exec_error_model";
export class ExecutorResult {
type: EXEC_TYPE;
event: EXEC_EVENT;

View file

@ -1,7 +1,6 @@
import { Trigger } from "../../features/triggers/trigger_model";
import { EXEC_TYPE } from "./exec_error_model";
export interface IPipeline {
process: IProcess;
trigger: Trigger;
@ -10,8 +9,8 @@ export interface IPipeline {
}
export enum StackGenerateType {
MAP = 'MAP',
SINGLETON = 'SINGLETON'
MAP = "MAP",
SINGLETON = "SINGLETON",
}
export interface Env {
@ -34,5 +33,3 @@ export enum IssueType {
WARNING = "WARNING",
ERROR = "ERROR",
}

View file

@ -44,8 +44,6 @@ export interface IHashesCache {
[key: string]: MetaDataFileManagerModel;
}
export abstract class IFilesChangeNotifierService {
abstract directory: string;
}

View file

@ -4,16 +4,12 @@ import {
} from "./files_change_notifier_service";
import { IPipeline } from "../model/process_model";
import { ExecutorProgramService } from "./executor_program_service";
import {
EXEC_EVENT,
ExecError,
SpawnError,
} from "../model/exec_error_model";
import { EXEC_EVENT, ExecError, SpawnError } from "../model/exec_error_model";
import { TypedEvent } from "../helper/typed_event";
import { Result } from "../helper/result";
import { ExecutorResult } from "../model/executor_result";
import { delay } from "../helper/delay";
import { TriggerErrorReport, TriggerService } from "./trigger_service";
import { TriggerService } from "./trigger_service";
import { Trigger } from "../../features/triggers/trigger_model";
export interface Iteration {
@ -92,7 +88,7 @@ export class StackService extends TypedEvent<string> implements IStackService {
);
triggerResult.fold(
(s) => {
s
s;
},
(e) => {
e;

View file

@ -3,10 +3,7 @@ import { IHashesCache } from "./files_change_notifier_service";
import { EventsFileChanger } from "../model/meta_data_file_manager_model";
import { Result } from "../helper/result";
import { TypedEvent } from "../helper/typed_event";
import {
Trigger,
TriggerType,
} from "../../features/triggers/trigger_model";
import { Trigger, TriggerType } from "../../features/triggers/trigger_model";
export class TriggerCallResult {
results: Array<TriggerSuccessResult | TriggerErrorReport>;

View file

@ -1,20 +1,15 @@
import {
IsString,
IsOptional,
ValidateNested,
IsEnum,
IsMongoId,
IsNumber,
IsBoolean,
} from "class-validator";
import { ObjectId, Schema, model } from "mongoose";
import { 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({

View file

@ -1,12 +1,12 @@
import mongoose, { Schema, model } from "mongoose";
import { Schema, model } from "mongoose";
import { PipelineModel, schemaPipeline } from "../pipelines/pipeline_model";
import { IsMongoId, IsString } from "class-validator";
export interface IProjectModel {
pipelines: [PipelineModel];
rootDir: string;
}
export const ProjectSchema = new Schema({
pipelines: {
type: Array<Schema.Types.ObjectId>,
@ -24,19 +24,8 @@ const schema = "Projects";
export const ProjectDBModel = model<IProjectModel>(schema, ProjectSchema);
export class ProjectModel implements IProjectModel {
@IsMongoId()
pipelines: [PipelineModel];
@IsString()
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;
// }

View file

@ -18,3 +18,4 @@ const computedFolder = "";
new App(httpRoutes, computedFolder).listen();