Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .development.env
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ PORT=5000
POSTGRES_HOST=postgres
POSTGRES_USER=postgres
POSTGRES_DB=nest-course
POSTGRESS_PASSWORD=root
POSTGRESS_PORT=5432
POSTGRES_PASSWORD=root

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.production.env needs to be fixed as well

POSTGRES_PORT=5432
PRIVATE_KEY=secret_key_safasf
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
6 changes: 1 addition & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,4 @@ COPY package*.json ./

RUN npm install

COPY . .

COPY ./dist ./dist

CMD ["npm", "run", "start:dev"]
COPY . .
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

в файле .development.env конфигурация для бд. Добавить свою.

#### npm run start:dev - Запуск

##

#### docker-compose up
```sh
npm install
```
```sh
docker-compose up
```
4 changes: 2 additions & 2 deletions src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import * as path from 'path';
SequelizeModule.forRoot({
dialect: 'postgres',
host: process.env.POSTGRES_HOST,
port: Number(process.env.POSTGRESS_PORT),
port: Number(process.env.POSTGRES_PORT),
username: process.env.POSTGRES_USER,
password: process.env.POSTGRESS_PASSWORD,
password: process.env.POSTGRES_PASSWORD,
database: process.env.POSTGRES_DB,
models: [User, Role, UserRoles, Post],
autoLoadModels: true
Expand Down
2 changes: 1 addition & 1 deletion src/users/users.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class UsersService {
async createUser(dto: CreateUserDto) {
const user = await this.userRepository.create(dto);
const role = await this.roleService.getRoleByValue("ADMIN")
await user.$set('roles', [role.id])
await user.$set('roles', [role?.id])
user.roles = [role]
return user;
}
Expand Down