View GR-new-db-model.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Module } from '@nestjs/common'; | |
import { NewAndTrendyDbModule } from '../../frameworks/data-services/mongo/NewAndTrendy-data-services.module'; | |
@Module({ | |
imports: [NewAndTrendyDbModule], | |
exports: [NewAndTrendyDbModule], | |
}) | |
export class DataServicesModule {} |
View GR-books-services.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@nestjs/common'; | |
import { Book } from '../../../core/entities'; | |
import { IDataServices, ICrmServices } from '../../../core/abstracts'; | |
@Injectable() | |
export class BookServices { | |
constructor( | |
private dataServices: IDataServices, | |
private crmServices: ICrmServices, | |
) {} |
View GR-app-module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Module } from '@nestjs/common'; | |
import { | |
BookController, | |
AuthorController, | |
GenreController, | |
} from './controllers'; | |
import { DataServicesModule } from './services/data-services/data-services.module'; | |
import { BookServicesModule } from './services/use-cases/book/book-services.module'; | |
@Module({ |
View GR-data-services-module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Module } from '@nestjs/common'; | |
import { MongoDataServicesModule } from '../../frameworks/data-services/mongo/mongo-data-services.module'; | |
@Module({ | |
imports: [MongoDataServicesModule], | |
exports: [MongoDataServicesModule], | |
}) | |
export class DataServicesModule {} |
View GR-mongo-module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Module } from '@nestjs/common'; | |
import { MongooseModule } from '@nestjs/mongoose'; | |
import { IDataServices } from '../../../core'; | |
import { DATA_BASE_CONFIGURATION } from '../../../configuration'; | |
import { | |
Author, | |
AuthorSchema, | |
Book, | |
BookSchema, | |
Genre, |
View GR-mongo-data-services.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable, OnApplicationBootstrap } from '@nestjs/common'; | |
import { InjectModel } from '@nestjs/mongoose'; | |
import { Model } from 'mongoose'; | |
import { IDataServices } from '../../../core'; | |
import { MongoGenericRepository } from './mongo-generic-repository'; | |
import { | |
Author, | |
AuthorDocument, | |
Book, | |
BookDocument, |
View GR-mongo-generic-repository.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Model } from 'mongoose'; | |
import { IGenericRepository } from '../../../core'; | |
export class MongoGenericRepository<T> implements IGenericRepository<T> { | |
private _repository: Model<T>; | |
private _populateOnFind: string[]; | |
constructor(repository: Model<T>, populateOnFind: string[] = []) { | |
this._repository = repository; | |
this._populateOnFind = populateOnFind; |
View GR-mongo-entities-book.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'; | |
import * as mongoose from 'mongoose'; | |
import { Author, Genre } from './'; | |
export type BookDocument = Book & Document; | |
@Schema() | |
export class Book { |
View GR-mongo-entities-genre.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'; | |
export type GenreDocument = Genre & Document; | |
@Schema() | |
export class Genre { | |
@Prop({ required: true, unique: true }) | |
name: string; | |
} |
NewerOlder