mvp progress
This commit is contained in:
parent
9b16b25187
commit
6446da7e76
75 changed files with 1865 additions and 244 deletions
|
@ -1,6 +1,6 @@
|
|||
import { IsMongoId, IsEnum } from "class-validator";
|
||||
import { Schema, model } from "mongoose";
|
||||
import { StackGenerateType } from "../../core/model/process_model";
|
||||
import { IProcess, StackGenerateType } from "../../core/model/process_model";
|
||||
import {
|
||||
TriggerModel,
|
||||
triggerSchema,
|
||||
|
@ -19,10 +19,7 @@ export const PipelineSchema = new Schema({
|
|||
ref: triggerSchema,
|
||||
autopopulate: true,
|
||||
default: null,
|
||||
},
|
||||
command: {
|
||||
type: String,
|
||||
},
|
||||
}
|
||||
}).plugin(require("mongoose-autopopulate"));
|
||||
|
||||
export const schemaPipeline = "Pipeline";
|
||||
|
@ -34,7 +31,7 @@ export const PipelineDBModel = model<PipelineModel>(
|
|||
|
||||
export class PipelineModel {
|
||||
@IsMongoId()
|
||||
public process: PipelineModel;
|
||||
public process: IProcess;
|
||||
|
||||
@IsMongoId()
|
||||
//TODO(IDONTSUDO):NEED OPTION DECORATOR??
|
||||
|
|
|
@ -6,16 +6,16 @@ import {
|
|||
IsBoolean,
|
||||
} from "class-validator";
|
||||
import { Schema, model } from "mongoose";
|
||||
import {
|
||||
IProcess,
|
||||
IssueType,
|
||||
} from "../../core/model/process_model";
|
||||
import { IProcess, IssueType } from "../../core/model/process_model";
|
||||
import { EXEC_TYPE } from "../../core/model/exec_error_model";
|
||||
|
||||
export const ProcessSchema = new Schema({
|
||||
type: {
|
||||
type: String,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
},
|
||||
command: {
|
||||
type: String,
|
||||
},
|
||||
|
@ -46,6 +46,9 @@ export class ProcessModel implements IProcess {
|
|||
@IsEnum(EXEC_TYPE)
|
||||
public type: EXEC_TYPE;
|
||||
|
||||
@IsString()
|
||||
public description: string;
|
||||
|
||||
@IsString()
|
||||
public command: string;
|
||||
|
||||
|
@ -61,9 +64,8 @@ export class ProcessModel implements IProcess {
|
|||
@IsOptional()
|
||||
@IsNumber()
|
||||
public timeout?: number;
|
||||
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
public commit?: string;
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ import { IsMongoId, IsString } from "class-validator";
|
|||
export interface IProjectModel {
|
||||
pipelines: [PipelineModel];
|
||||
rootDir: string;
|
||||
description: string;
|
||||
}
|
||||
|
||||
export const ProjectSchema = new Schema({
|
||||
|
@ -17,6 +18,9 @@ export const ProjectSchema = new Schema({
|
|||
rootDir: {
|
||||
type: String,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
},
|
||||
}).plugin(require("mongoose-autopopulate"));
|
||||
|
||||
const schema = "Projects";
|
||||
|
@ -25,7 +29,11 @@ export const ProjectDBModel = model<IProjectModel>(schema, ProjectSchema);
|
|||
|
||||
export class ProjectModel implements IProjectModel {
|
||||
@IsMongoId()
|
||||
pipelines: [PipelineModel];
|
||||
public pipelines: [PipelineModel];
|
||||
|
||||
@IsString()
|
||||
rootDir: string;
|
||||
public rootDir: string;
|
||||
|
||||
@IsString()
|
||||
public description: string;
|
||||
}
|
||||
|
|
29
server/src/features/realtime/realtime_presentation.ts
Normal file
29
server/src/features/realtime/realtime_presentation.ts
Normal file
|
@ -0,0 +1,29 @@
|
|||
import { CoreHttpController } from "../../core/controllers/http_controller";
|
||||
import { Result } from "../../core/helper/result";
|
||||
import { IPipelineMeta } from "../../core/model/pipiline_meta";
|
||||
import {
|
||||
PipelineRealTimeService,
|
||||
} from "../../core/services/pipeline_real_time_service";
|
||||
|
||||
export const pipelineRealTimeService = new PipelineRealTimeService();
|
||||
|
||||
class PipelineStatusUseCase {
|
||||
async call(): Promise<Result<Error, IPipelineMeta>> {
|
||||
try {
|
||||
return Result.ok(pipelineRealTimeService.status);
|
||||
} catch (error) {
|
||||
return Result.error(error as Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class RealTimePresentation extends CoreHttpController<void> {
|
||||
constructor() {
|
||||
super({
|
||||
validationModel: null,
|
||||
url: "realtime",
|
||||
databaseModel: null,
|
||||
});
|
||||
super.get(new PipelineStatusUseCase().call);
|
||||
}
|
||||
}
|
|
@ -1,9 +1,10 @@
|
|||
import { IsArray, IsOptional, IsEnum} from "class-validator";
|
||||
import { IsArray, IsOptional, IsEnum, IsString } from "class-validator";
|
||||
import { Schema, model } from "mongoose";
|
||||
|
||||
export interface ITriggerModel {
|
||||
_id?: string;
|
||||
type: string;
|
||||
description: string;
|
||||
value: string[];
|
||||
}
|
||||
|
||||
|
@ -12,6 +13,9 @@ export const TriggerSchema = new Schema({
|
|||
type: String,
|
||||
require: true,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
},
|
||||
value: {
|
||||
type: Array,
|
||||
require: true,
|
||||
|
@ -20,7 +24,10 @@ export const TriggerSchema = new Schema({
|
|||
|
||||
export const triggerSchema = "Trigger";
|
||||
|
||||
export const TriggerDBModel = model<ITriggerModel>(triggerSchema, TriggerSchema);
|
||||
export const TriggerDBModel = model<ITriggerModel>(
|
||||
triggerSchema,
|
||||
TriggerSchema
|
||||
);
|
||||
|
||||
export enum TriggerType {
|
||||
PROCESS = "PROCESS",
|
||||
|
@ -30,6 +37,8 @@ export enum TriggerType {
|
|||
export class TriggerModel implements ITriggerModel {
|
||||
@IsOptional()
|
||||
public _id: string;
|
||||
@IsString()
|
||||
public description;
|
||||
@IsEnum(TriggerType)
|
||||
public type: TriggerType;
|
||||
@IsArray()
|
||||
|
@ -40,4 +49,3 @@ export interface Trigger {
|
|||
type: TriggerType;
|
||||
value: string[];
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue