generated from bcgov/quickstart-openshift
-
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.
Merge branch 'main' into add-frontend-api
- Loading branch information
Showing
18 changed files
with
351 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,41 @@ | ||
generator client { | ||
provider = "prisma-client-js" | ||
provider = "prisma-client-js" | ||
previewFeatures = ["metrics"] | ||
} | ||
|
||
datasource db { | ||
provider = "postgresql" | ||
url = env("DATABASE_URL") | ||
url = env("POSTGRESQL_URL") | ||
} | ||
|
||
model users { | ||
id Decimal @id(map: "USER_PK") @default(dbgenerated("nextval('\"USER_SEQ\"'::regclass)")) @db.Decimal | ||
name String @db.VarChar(200) | ||
email String @db.VarChar(200) | ||
/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments | ||
model submission_status_code { | ||
submission_status_code String @id(map: "submission_status_code_pk") @db.VarChar(20) | ||
description String @db.VarChar(250) | ||
display_order Int | ||
active_ind Boolean @default(true) | ||
create_user_id String @db.VarChar(200) | ||
create_utc_timestamp DateTime @db.Timestamp(6) | ||
update_user_id String @db.VarChar(200) | ||
update_utc_timestamp DateTime @db.Timestamp(6) | ||
file_submissions_file_submissions_submission_status_codeTosubmission_status_code file_submissions[] @relation("file_submissions_submission_status_codeTosubmission_status_code") | ||
} | ||
|
||
model file_submissions { | ||
submission_id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid | ||
file_name String @db.VarChar(200) | ||
submission_date DateTime @db.Timestamp(6) | ||
submitter_user_id String @db.VarChar(200) | ||
submission_status_code String @db.VarChar(10) | ||
submitter_agency_name String @db.VarChar(200) | ||
sample_count Int? | ||
results_count Int? | ||
active_ind Boolean @default(true) | ||
error_log String? | ||
organization_guid String? @db.Uuid | ||
create_user_id String @db.VarChar(200) | ||
create_utc_timestamp DateTime @db.Timestamp(6) | ||
update_user_id String @db.VarChar(200) | ||
update_utc_timestamp DateTime @db.Timestamp(6) | ||
submission_status_code_file_submissions_submission_status_codeTosubmission_status_code submission_status_code @relation("file_submissions_submission_status_codeTosubmission_status_code", fields: [submission_status_code], references: [submission_status_code], onDelete: NoAction, onUpdate: NoAction, map: "submission_status_code_fk") | ||
} |
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 { DryrunController } from './dryrun.controller'; | ||
import { DryrunService } from './dryrun.service'; | ||
|
||
describe('DryrunController', () => { | ||
let controller: DryrunController; | ||
|
||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
controllers: [DryrunController], | ||
providers: [DryrunService], | ||
}).compile(); | ||
|
||
controller = module.get<DryrunController>(DryrunController); | ||
}); | ||
|
||
it('should be defined', () => { | ||
expect(controller).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,39 @@ | ||
import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common'; | ||
import { DryrunService } from './dryrun.service'; | ||
import { CreateDryrunDto } from './dto/create-dryrun.dto'; | ||
import { UpdateDryrunDto } from './dto/update-dryrun.dto'; | ||
import { ApiTags } from '@nestjs/swagger'; | ||
import { DryrunDto } from './dto/dryrun.dto'; | ||
|
||
@ApiTags("dryrun") | ||
@Controller({path: "dryrun", version: "1"}) | ||
export class DryrunController { | ||
constructor(private readonly dryrunService: DryrunService) {} | ||
|
||
@Post() | ||
create(@Body() createDryrunDto: CreateDryrunDto) { | ||
console.log("I AM HERE!!!"); | ||
return this.dryrunService.create(createDryrunDto); | ||
} | ||
|
||
@Get() | ||
findAll() { | ||
console.log('FIND ALL HERE!!!') | ||
return this.dryrunService.findAll(); | ||
} | ||
|
||
@Get(':id') | ||
findOne(@Param('id') id: string) { | ||
return this.dryrunService.findOne(+id); | ||
} | ||
|
||
@Patch(':id') | ||
update(@Param('id') id: string, @Body() updateDryrunDto: UpdateDryrunDto) { | ||
return this.dryrunService.update(+id, updateDryrunDto); | ||
} | ||
|
||
@Delete(':id') | ||
remove(@Param('id') id: string) { | ||
return this.dryrunService.remove(+id); | ||
} | ||
} |
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,9 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { DryrunService } from './dryrun.service'; | ||
import { DryrunController } from './dryrun.controller'; | ||
|
||
@Module({ | ||
controllers: [DryrunController], | ||
providers: [DryrunService], | ||
}) | ||
export class DryrunModule {} |
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,18 @@ | ||
import { Test, TestingModule } from '@nestjs/testing'; | ||
import { DryrunService } from './dryrun.service'; | ||
|
||
describe('DryrunService', () => { | ||
let service: DryrunService; | ||
|
||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
providers: [DryrunService], | ||
}).compile(); | ||
|
||
service = module.get<DryrunService>(DryrunService); | ||
}); | ||
|
||
it('should be defined', () => { | ||
expect(service).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,36 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
import { CreateDryrunDto } from './dto/create-dryrun.dto'; | ||
import { UpdateDryrunDto } from './dto/update-dryrun.dto'; | ||
import { PrismaService } from 'nestjs-prisma'; | ||
import { Prisma } from "@prisma/client"; | ||
import { DryrunDto } from './dto/dryrun.dto'; | ||
|
||
@Injectable() | ||
export class DryrunService { | ||
constructor( | ||
private prisma: PrismaService | ||
) { | ||
} | ||
|
||
create(createDryrunDto: CreateDryrunDto) { | ||
console.log("I WILL SEND THE POST FROM HERE!!!"); | ||
return 'This action adds a new dryrun'; | ||
} | ||
|
||
async findAll() { | ||
const files = await this.prisma.file_submissions.findMany(); | ||
console.log(files) | ||
} | ||
|
||
findOne(id: number) { | ||
return `This action returns a #${id} dryrun`; | ||
} | ||
|
||
update(id: number, updateDryrunDto: UpdateDryrunDto) { | ||
return `This action updates a #${id} dryrun`; | ||
} | ||
|
||
remove(id: number) { | ||
return `This action removes a #${id} dryrun`; | ||
} | ||
} |
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,13 @@ | ||
import { PickType } from "@nestjs/swagger"; | ||
import { DryrunDto } from "./dryrun.dto"; | ||
|
||
export class CreateDryrunDto extends PickType(DryrunDto, [ | ||
'submission_status_code', | ||
'description', | ||
'display_order', | ||
'active_ind', | ||
'create_user_id', | ||
'create_utc_timestamp', | ||
'update_user_id', | ||
'update_utc_timestamp', | ||
] as const) {} |
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,46 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
|
||
export class DryrunDto { | ||
@ApiProperty({ | ||
description: 'Unique identifies for the submitted file', | ||
// default: '9999', | ||
}) | ||
submission_status_code: string; | ||
|
||
@ApiProperty({ | ||
description: 'Full name of the code', | ||
// default: 'username', | ||
}) | ||
description: string; | ||
|
||
@ApiProperty({ | ||
description: 'Order in which the code appears', | ||
}) | ||
display_order: number; | ||
|
||
@ApiProperty({ | ||
description: 'True if active, false otherwise', | ||
default: true, | ||
}) | ||
active_ind: boolean | ||
|
||
@ApiProperty({ | ||
description: 'The id of the user that created the record', | ||
}) | ||
create_user_id: string; | ||
|
||
@ApiProperty({ | ||
description: 'When the user created the record', | ||
}) | ||
create_utc_timestamp: Date; | ||
|
||
@ApiProperty({ | ||
description: 'The id of the user that last updated the record', | ||
}) | ||
update_user_id: string; | ||
|
||
@ApiProperty({ | ||
description: 'When the user last updated the record', | ||
}) | ||
update_utc_timestamp: Date; | ||
} |
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,3 @@ | ||
import { CreateDryrunDto } from './create-dryrun.dto'; | ||
|
||
export class UpdateDryrunDto extends CreateDryrunDto {} |
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 @@ | ||
export class Dryrun {} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
Oops, something went wrong.