-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(): add schemas for specialties and suppliers
- Loading branch information
Showing
12 changed files
with
344 additions
and
239 deletions.
There are no files selected for viewing
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,10 @@ | ||
|
||
import { Controller, Get } from '@nestjs/common'; | ||
|
||
@Controller('providers') | ||
export class ProvidersController { | ||
@Get() | ||
findAll(): string { | ||
return 'This action returns all providers'; | ||
} | ||
} |
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 { Module } from '@nestjs/common'; | ||
import { MongooseModule } from '@nestjs/mongoose'; | ||
import { ProvidersController } from './providers.controller'; | ||
import { ProvidersService } from './providers.serrvice'; | ||
import { ProvidersSchema } from './providers.schema'; | ||
|
||
@Module({ | ||
imports: [ | ||
MongooseModule.forFeatureAsync([ | ||
{ | ||
name: 'Providers', | ||
useFactory: () => { | ||
const schema = ProvidersSchema; | ||
schema.pre('save', () => console.log('Hello from pre save')); | ||
return schema; | ||
}, | ||
}, | ||
]), | ||
], | ||
controllers: [ProvidersController], | ||
providers: [ProvidersService], | ||
}) | ||
export class ProvidersModule {} |
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,100 @@ | ||
import * as mongoose from 'mongoose'; | ||
|
||
export const ProvidersSchema = new mongoose.Schema({ | ||
email: { | ||
type: String, | ||
lowercase: true, | ||
required: true, | ||
unique: true, | ||
}, | ||
firstName: { | ||
type: String, | ||
required: false, | ||
}, | ||
lastName: { | ||
type: String, | ||
required: false, | ||
}, | ||
specialty: { | ||
type: mongoose.Schema.Types.ObjectId, | ||
ref: 'Specialty' | ||
}, | ||
projectedStartDate: { | ||
type: Date, | ||
default: new Date() | ||
}, | ||
providerType: { | ||
type: String, | ||
enum: [ | ||
'APRN', | ||
'ARNP', | ||
'CNS', | ||
'CRNA', | ||
'DC', | ||
'DDS', | ||
'DMD', | ||
'DO', | ||
'DPM', | ||
'LCMFT', | ||
'LCMHC', | ||
'LCP', | ||
'LCPC', | ||
'MD', | ||
'NP', | ||
'PA' | ||
] | ||
}, | ||
staffStatus: { | ||
type: String, | ||
enum: [ | ||
'ACTIVE', | ||
'AFFILIATE', | ||
'ASSOCIATE', | ||
'COMMUNITY', | ||
'CONSULTING', | ||
'COURTESY', | ||
'FACULTY', | ||
'HONORARY', | ||
'HOSPITALIST', | ||
'HAUSE_STAFF', | ||
'LOCUM_TENENS', | ||
'PROVISIONAL', | ||
'RESIDENT', | ||
'TEACHING' | ||
] | ||
}, | ||
status: { | ||
type: String, | ||
enum: [ | ||
'AWAITING_CREDENTIALS', | ||
'READY_FOR_REVIEW', | ||
'UNDER_REVIEW', | ||
'AWAITING_DECISION', | ||
'APPROVED', | ||
'DENIED' | ||
], | ||
default: 'AWAITING_CREDENTIALS' | ||
}, | ||
employerId: { | ||
type: Number, | ||
required: true | ||
}, | ||
assignedTo: { | ||
type: Number, | ||
required: true | ||
}, | ||
createdBy: { | ||
type: Number, | ||
required: true | ||
}, | ||
updatedBy: { | ||
type: Number, | ||
required: true | ||
} | ||
}, { | ||
collection: 'providers', | ||
timestamps: { | ||
createdAt: 'created_at', | ||
updatedAt: 'updated_at', | ||
} | ||
}); |
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 { Injectable } from '@nestjs/common'; | ||
|
||
@Injectable() | ||
export class ProvidersService { | ||
private readonly data: any[] = []; | ||
|
||
create(data: any) { | ||
this.data.push(data); | ||
} | ||
|
||
findAll(): any[] { | ||
return this.data; | ||
} | ||
} |
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,4 @@ | ||
export interface Data { | ||
name: string; | ||
age: number; | ||
} |
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,10 @@ | ||
|
||
import { Controller, Get } from '@nestjs/common'; | ||
|
||
@Controller('specialties') | ||
export class SpecialtiesController { | ||
@Get() | ||
findAll(): string { | ||
return 'This action returns all specialties'; | ||
} | ||
} |
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,10 @@ | ||
|
||
import { Module } from '@nestjs/common'; | ||
import { SpecialtiesController } from './specialties.controller'; | ||
import { SpecialtiesService } from './specialties.service'; | ||
|
||
@Module({ | ||
controllers: [SpecialtiesController], | ||
providers: [SpecialtiesService], | ||
}) | ||
export class SpecialtiesModule {} |
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 * as mongoose from 'mongoose'; | ||
|
||
export const SpecialtiesSchema = new mongoose.Schema({ | ||
name: { | ||
type: String, | ||
lowercase: true, | ||
required: true, | ||
}, | ||
createdBy: { | ||
type: Number, | ||
required: false, | ||
}, | ||
updatedBy: { | ||
type: Number, | ||
required: false, | ||
} | ||
}, { | ||
collection: 'specialties', | ||
timestamps: { | ||
createdAt: 'created_at', | ||
updatedAt: 'updated_at', | ||
} | ||
}); |
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,15 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
import { Data } from './interfaces/data.interface'; | ||
|
||
@Injectable() | ||
export class SpecialtiesService { | ||
private readonly data: Data[] = []; | ||
|
||
create(data: Data) { | ||
this.data.push(data); | ||
} | ||
|
||
findAll(): Data[] { | ||
return this.data; | ||
} | ||
} |
Oops, something went wrong.