-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
258fdaf
commit 11ffef7
Showing
19 changed files
with
594 additions
and
65 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { AppController } from './app.controller'; | ||
import { AppService } from './app.service'; | ||
import { AuthController } from './auth/auth.controller'; | ||
import { AuthService } from './auth/auth.service'; | ||
import { InsuranceController } from './insurance/insurance.controller'; | ||
import { InsuranceService } from './insurance/insurance.service'; | ||
import { UserController } from './user/user.controller'; | ||
import { UserService } from './user/user.service'; | ||
import { ServiceController } from './services/service.controller'; | ||
import { ServiceService } from './services/service.service'; | ||
|
||
@Module({ | ||
imports: [], | ||
controllers: [AppController, AuthController, InsuranceController, UserController], | ||
providers: [AppService, AuthService, InsuranceService, UserService], | ||
controllers: [AuthController, InsuranceController, UserController, ServiceController], | ||
providers: [AuthService, InsuranceService, UserService, ServiceService], | ||
}) | ||
export class AppModule {} |
This file was deleted.
Oops, something went wrong.
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import mongoose, { Schema, Document, Model } from 'mongoose'; | ||
|
||
export interface IInsurancePlan extends Document { | ||
name: string; | ||
description: string; | ||
monthlyPremium: number; | ||
coverageDetails: string; | ||
eligibility: string; | ||
} | ||
|
||
const InsurancePlanSchema = new Schema<IInsurancePlan>( | ||
{ | ||
name: { type: String, required: true }, | ||
description: { type: String, required: true }, | ||
monthlyPremium: { type: Number, required: true }, | ||
coverageDetails: { type: String, required: true }, | ||
eligibility: { type: String, required: true }, | ||
}, | ||
{ timestamps: true } | ||
); | ||
|
||
export const InsurancePlan: Model<IInsurancePlan> = mongoose.model('InsurancePlan', InsurancePlanSchema); |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Test, TestingModule } from '@nestjs/testing'; | ||
import { ServiceController } from './service.controller'; | ||
import { ServiceService } from './service.service'; | ||
|
||
describe('ServiceController', () => { | ||
let serviceController: ServiceController; | ||
|
||
beforeEach(async () => { | ||
const app: TestingModule = await Test.createTestingModule({ | ||
controllers: [ServiceController], | ||
providers: [ServiceService], | ||
}).compile(); | ||
|
||
serviceController = app.get<ServiceController>(ServiceController); | ||
}); | ||
|
||
it('should be defined', () => { | ||
expect(serviceController).toBeDefined(); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Controller } from '@nestjs/common'; | ||
import { ServiceService } from './service.service'; | ||
|
||
@Controller('service') | ||
export class ServiceController { | ||
constructor(private readonly serviceService: ServiceService) {} | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { ServiceService } from './service.service'; | ||
import { ServiceController } from './service.controller'; | ||
|
||
|
||
@Module({ | ||
imports: [], | ||
controllers: [ServiceController], | ||
providers: [ServiceService], | ||
}) | ||
export class ServiceModule {} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import mongoose, { Schema, Document, Model } from 'mongoose'; | ||
|
||
export interface IService extends Document { | ||
name: string; | ||
description: string; | ||
cost: number; | ||
location: string; | ||
eligibility: string; | ||
languagesSupported: string[]; | ||
} | ||
|
||
const ServiceSchema = new Schema<IService>( | ||
{ | ||
name: { type: String, required: true }, | ||
description: { type: String, required: true }, | ||
cost: { type: Number, required: true }, | ||
location: { type: String, required: true }, | ||
eligibility: { type: String, required: true }, | ||
languagesSupported: { type: [String], default: [] }, | ||
}, | ||
{ timestamps: true } | ||
); | ||
|
||
export const Service: Model<IService> = mongoose.model('Service', ServiceSchema); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
|
||
@Injectable() | ||
export class ServiceService { | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,9 @@ | ||
import { Controller, Delete, Get } from '@nestjs/common'; | ||
import { Controller, Req, Get, Post, Put, Delete, Param, Body, UseGuards } from '@nestjs/common'; | ||
import { UserService } from './user.service'; | ||
|
||
@Controller('user') | ||
export class UserController { | ||
constructor(private readonly userService: UserService) {} | ||
|
||
@Get() | ||
get(): string { | ||
return "User is running!"; | ||
} | ||
|
||
@Delete("delete") | ||
delete(): string { | ||
return "delete!"; | ||
} | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import mongoose, { Schema, Document, Model } from 'mongoose'; | ||
|
||
export interface IUser extends Document { | ||
name: string; | ||
email: string; | ||
password: string; | ||
role: string; | ||
savedServices: string[]; | ||
language: string; | ||
} | ||
|
||
const UserSchema = new Schema<IUser>( | ||
{ | ||
name: { type: String, required: true }, | ||
email: { type: String, required: true, unique: true }, | ||
password: { type: String, required: true }, | ||
role: { type: String, required: true }, | ||
savedServices: { type: [String], default: [] }, | ||
}, | ||
{ timestamps: true } | ||
); | ||
|
||
export const User: Model<IUser> = mongoose.model('User', UserSchema); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
import { User } from './user.schema'; | ||
|
||
@Injectable() | ||
export class UserService { | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import mongoose from 'mongoose'; | ||
require('dotenv').config(); | ||
|
||
const connectDB = async () => { | ||
try { | ||
await mongoose.connect(process.env.MONGO_URI || '') | ||
console.log('MongoDB connected'); | ||
} catch (error: any) { | ||
console.error(error.message); | ||
setTimeout(connectDB, 5000); | ||
} | ||
}; | ||
|
||
export default connectDB; |