-
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.
Database configuration and companies endpoint
- Loading branch information
1 parent
ef29648
commit 51e1a41
Showing
18 changed files
with
929 additions
and
54 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
DATABASE_HOST=db | ||
DATABASE_USER=postgres | ||
DATABASE_NAME=nestjs | ||
DATABASE_PORT=5432 | ||
DATABASE_PASSWORD= |
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 @@ | ||
# Use the official Node.js 16 image as the base image | ||
FROM node:16 | ||
|
||
# Set the working directory in the container | ||
WORKDIR /app | ||
|
||
# Copy the package.json and package-lock.json to the working directory | ||
COPY package*.json ./ | ||
|
||
# Install Node.js dependencies | ||
RUN npm install | ||
|
||
# Copy the rest of the application code to the container | ||
COPY . . | ||
|
||
# Expose the port your Nest.js app will run on | ||
EXPOSE 3000 | ||
|
||
# Start the Nest.js application | ||
CMD ["npm", "run", "start:dev"] |
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,25 @@ | ||
version: '3.7' | ||
services: | ||
db: | ||
image: postgres | ||
volumes: | ||
- 'postgres:/var/lib/postgresql/data' | ||
environment: | ||
POSTGRES_HOST_AUTH_METHOD: trust | ||
POSTGRES_DB: nestjs | ||
web: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.dev | ||
ports: | ||
- "3000:3000" | ||
volumes: | ||
- .:/app | ||
command: npm run start:dev | ||
env_file: | ||
- .env | ||
depends_on: | ||
- postgres | ||
|
||
volumes: | ||
postgres: |
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,37 @@ | ||
import { | ||
MigrationInterface, | ||
QueryRunner, | ||
Table, | ||
} from "typeorm" | ||
|
||
export class CreateCompany1697905863173 implements MigrationInterface { | ||
async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.createTable( | ||
new Table({ | ||
name: "company", | ||
columns: [ | ||
{ | ||
name: "id", | ||
type: "int", | ||
isPrimary: true, | ||
isGenerated: true, | ||
generationStrategy: 'increment', | ||
}, | ||
{ | ||
name: "name", | ||
type: "varchar", | ||
}, | ||
{ | ||
name: "location", | ||
type: "varchar", | ||
}, | ||
], | ||
}), | ||
true, | ||
) | ||
} | ||
|
||
async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.dropTable("company") | ||
} | ||
} |
Oops, something went wrong.