Skip to content

Commit

Permalink
feat: added content pages module
Browse files Browse the repository at this point in the history
  • Loading branch information
Hardik-hi committed Aug 1, 2022
1 parent 6dcd408 commit 3d74926
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/adapters/contentpagesservicelocator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { ContentPagesDto } from "src/contentPages/dto/contentPages.dto";

export interface IServicelocator {

}
12 changes: 12 additions & 0 deletions src/adapters/esamwad/contentPages.adapter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Injectable } from "@nestjs/common";
import { HttpService } from "@nestjs/axios";
import { IServicelocator } from "../contentpagesservicelocator";

export const ESamwadContentPagesToken = "ESamwadContentPages";

@Injectable()
export class ContentPagesEsamwadService implements IServicelocator {
constructor(private httpService: HttpService) { }
baseURL = process.env.HASURAURL;
adminSecret = process.env.ADMINSECRET;
}
4 changes: 3 additions & 1 deletion src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { AssessmentSetModule } from "./assessmentset/assessmentset.module";
import { InAppNotificationModule } from "./inAppNotification/inAppNotification.module";
import { MentorTrackingModule } from "./mentorTracking/mentorTracking.module";
import { MonitorTrackingModule } from "./monitorTracking/monitorTracking.module";
import { ContentPagesModule } from './contentPages/contentPages.module';
@Module({
imports: [
ConfigModule.forRoot(),
Expand Down Expand Up @@ -51,8 +52,9 @@ import { MonitorTrackingModule } from "./monitorTracking/monitorTracking.module"
InAppNotificationModule,
MentorTrackingModule,
MonitorTrackingModule,
ContentPagesModule,
],
controllers: [AppController],
providers: [AppService],
})
export class AppModule {}
export class AppModule { }
18 changes: 18 additions & 0 deletions src/contentPages/content-pages.controller.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Test, TestingModule } from '@nestjs/testing';
import { ContentPagesController } from './contentPages.controller';

describe('ContentPagesController', () => {
let controller: ContentPagesController;

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
controllers: [ContentPagesController],
}).compile();

controller = module.get<ContentPagesController>(ContentPagesController);
});

it('should be defined', () => {
expect(controller).toBeDefined();
});
});
18 changes: 18 additions & 0 deletions src/contentPages/contentPages.controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {
Controller,
Inject,
} from "@nestjs/common";
import { IServicelocator } from "src/adapters/contentpagesservicelocator";
import {
ContentPagesEsamwadService,
ESamwadContentPagesToken,
} from "src/adapters/esamwad/contentPages.adapter";

@Controller('contentPages')
export class ContentPagesController {
constructor(private hasuraService: ContentPagesEsamwadService,
@Inject(ESamwadContentPagesToken) private eSamwadProvider: IServicelocator) { }

//api calls

}
27 changes: 27 additions & 0 deletions src/contentPages/contentPages.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { CacheModule, Module } from "@nestjs/common";
import { HttpModule } from "@nestjs/axios";
import { ScheduleModule } from "@nestjs/schedule";
import { ContentPagesController } from './contentPages.controller';
import {
ContentPagesEsamwadService,
ESamwadContentPagesToken,
} from "src/adapters/esamwad/contentPages.adapter";

const ttl = process.env.TTL as never;
@Module({
imports: [
HttpModule,
CacheModule.register({
ttl: ttl,
}),
ScheduleModule.forRoot(),
],
providers: [
ContentPagesEsamwadService, {
provide: ESamwadContentPagesToken,
useClass: ContentPagesEsamwadService
}
],
controllers: [ContentPagesController],
})
export class ContentPagesModule { }
1 change: 1 addition & 0 deletions src/contentPages/dto/contentPages.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export class ContentPagesDto { }

0 comments on commit 3d74926

Please sign in to comment.