Skip to content

Commit

Permalink
feat: mapping repository
Browse files Browse the repository at this point in the history
  • Loading branch information
chavda-bhavik committed Oct 7, 2022
1 parent 5276a52 commit aa738d5
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libs/dal/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ export * from './repositories/common';
export * from './repositories/template';
export * from './repositories/column';
export * from './repositories/file';
export * from './repositories/upload';
export * from './repositories/mapping';
3 changes: 3 additions & 0 deletions libs/dal/src/repositories/mapping/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './mapping.entity';
export * from './mapping.repository';
export * from './mapping.schema';
9 changes: 9 additions & 0 deletions libs/dal/src/repositories/mapping/mapping.entity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export class MappingEntity {
_id?: string;

_columnId: string;

_uploadId: string;

columnHeading: string;
}
9 changes: 9 additions & 0 deletions libs/dal/src/repositories/mapping/mapping.repository.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { BaseRepository } from '../base-repository';
import { MappingEntity } from './mapping.entity';
import { Mapping } from './mapping.schema';

export class MappingRepository extends BaseRepository<MappingEntity> {
constructor() {
super(Mapping, MappingEntity);
}
}
24 changes: 24 additions & 0 deletions libs/dal/src/repositories/mapping/mapping.schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Schema, Document, model, models } from 'mongoose';
import { schemaOptions } from '../schema-default.options';
import { MappingEntity } from './mapping.entity';

const mappingSchema = new Schema(
{
columnHeading: String,
_columnId: {
type: Schema.Types.String,
ref: 'Column',
},
_uploadId: {
type: Schema.Types.String,
ref: 'Upload',
},
},
{ ...schemaOptions }
);

interface IMappingDocument extends MappingEntity, Document {
_id: never;
}

export const Mapping = models.Mapping || model<IMappingDocument>('Mapping', mappingSchema);

0 comments on commit aa738d5

Please sign in to comment.