Skip to content

Commit

Permalink
fix: small code corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
brenogonzaga committed Jul 31, 2024
1 parent e480529 commit 38eb9b5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion backend/.env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
DB_HOST=localhost
DB_PORT=5432
DB_PORT=5445
DB_USERNAME=myuser
DB_PASSWORD=mypassword
DB_DATABASE=mydb
Expand Down
9 changes: 9 additions & 0 deletions backend/src/user/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ export class UserService {
throw new BadRequestException(`User with email ${email} already exists`);
}

if (!password || password.length < 6) {
await this.userRepository.update(id, { name, email, isActive });
return;
}
await this.userRepository.update(id, { name, email, password, isActive });
}
/**
Expand All @@ -156,6 +160,11 @@ export class UserService {
throw new BadRequestException(`User with email ${email} already exists`);
}

if (!password || password.length < 6) {
await this.userRepository.update(id, { name, email, isActive });
return;
}

await this.userRepository.update(id, { name, email, password, isActive });
}
/**
Expand Down
3 changes: 3 additions & 0 deletions frontend/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,8 @@
}
}
}
},
"cli": {
"analytics": false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class ListProductsComponent implements OnInit {
summary: 'Sucesso',
detail: 'Produto atualizado com sucesso',
});
this.router.navigate(['/dashboard/list-products']);
this.router.navigate(['/dashboard/list-product']);
},
(error) => {
this.messageService.add({
Expand All @@ -61,7 +61,9 @@ export class ListProductsComponent implements OnInit {
summary: 'Sucesso',
detail: 'Produto deletado com sucesso!',
});
this.router.navigate(['/dashboard/list-products']);
this.products = this.products.filter(
(p) => p.productCode !== product.productCode,
);
},
(error) => {
this.messageService.add({
Expand Down

0 comments on commit 38eb9b5

Please sign in to comment.