crud and http controller
This commit is contained in:
parent
cba12be4b1
commit
c27c061c15
51 changed files with 930 additions and 387 deletions
19
server/src/features/compositions/composition_model.ts
Normal file
19
server/src/features/compositions/composition_model.ts
Normal file
|
@ -0,0 +1,19 @@
|
|||
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 {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
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,
|
||||
});
|
||||
}
|
||||
|
||||
}
|
19
server/src/features/functions/functions_model.ts
Normal file
19
server/src/features/functions/functions_model.ts
Normal file
|
@ -0,0 +1,19 @@
|
|||
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 {
|
||||
|
||||
}
|
||||
|
15
server/src/features/functions/functions_presentation.ts
Normal file
15
server/src/features/functions/functions_presentation.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
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,
|
||||
});
|
||||
}
|
||||
}
|
14
server/src/features/projects/projects_model.ts
Normal file
14
server/src/features/projects/projects_model.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
import { IsArray, IsString, IsOptional } from "class-validator";
|
||||
import { Schema, model } from "mongoose";
|
||||
|
||||
export interface IProjectModel {}
|
||||
|
||||
export const ProjectSchema = new Schema({
|
||||
|
||||
});
|
||||
|
||||
const schema = "Projects";
|
||||
|
||||
export const ProjectDBModel = model<IProjectModel>(schema, ProjectSchema);
|
||||
|
||||
export class ProjectModel implements IProjectModel {}
|
16
server/src/features/projects/projects_presentation.ts
Normal file
16
server/src/features/projects/projects_presentation.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
// import { TriggerDBModel, TriggerModel } from "./trigger_model";
|
||||
import { CrudController } from "../../core/controllers/crud_controller";
|
||||
import { ProjectDBModel, ProjectModel } from "./projects_model";
|
||||
|
||||
export class ProjectsPresentation extends CrudController<
|
||||
ProjectModel,
|
||||
typeof ProjectDBModel
|
||||
> {
|
||||
constructor() {
|
||||
super({
|
||||
url: "project",
|
||||
validationModel: ProjectModel,
|
||||
databaseModel: ProjectDBModel,
|
||||
});
|
||||
}
|
||||
}
|
43
server/src/features/triggers/trigger_model.ts
Normal file
43
server/src/features/triggers/trigger_model.ts
Normal file
|
@ -0,0 +1,43 @@
|
|||
import { IsArray, IsString, IsOptional } from "class-validator";
|
||||
import { Schema, model } from "mongoose";
|
||||
|
||||
export interface ITriggerModel {
|
||||
_id?: string;
|
||||
type: string;
|
||||
value: string[];
|
||||
}
|
||||
|
||||
export const TriggerSchema = new Schema({
|
||||
type: {
|
||||
type: String,
|
||||
require: true,
|
||||
},
|
||||
value: {
|
||||
type: Array,
|
||||
require: true,
|
||||
},
|
||||
});
|
||||
|
||||
const schema = "Trigger";
|
||||
|
||||
export const TriggerDBModel = model<ITriggerModel>(schema, TriggerSchema);
|
||||
|
||||
export class TriggerModel implements ITriggerModel {
|
||||
@IsOptional()
|
||||
public _id: string;
|
||||
@IsString()
|
||||
public type: string;
|
||||
|
||||
@IsArray()
|
||||
public value: string[];
|
||||
}
|
||||
|
||||
export interface Trigger {
|
||||
type: TriggerType;
|
||||
value: string[];
|
||||
}
|
||||
|
||||
export enum TriggerType {
|
||||
PROCESS = "PROCESS",
|
||||
FILE = "FILE",
|
||||
}
|
15
server/src/features/triggers/triggers_presentation.ts
Normal file
15
server/src/features/triggers/triggers_presentation.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
import { TriggerDBModel, TriggerModel } from "./trigger_model";
|
||||
import { CrudController } from "../../core/controllers/crud_controller";
|
||||
|
||||
export class TriggerPresentation extends CrudController<
|
||||
TriggerModel,
|
||||
typeof TriggerDBModel
|
||||
> {
|
||||
constructor() {
|
||||
super({
|
||||
url: "trigger",
|
||||
validationModel: TriggerModel,
|
||||
databaseModel: TriggerDBModel,
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue