-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature brands relation #144
base: main
Are you sure you want to change the base?
Changes from all commits
656f98c
bc114ec
e4270b7
152f103
f9c6609
1fe07c9
77aadd2
9ab0cce
1d4c454
5cc84ad
90deb4a
098e8a5
4890670
f54fc5e
f1bf940
fd4c30c
e4aeea2
17fea32
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,20 +15,16 @@ export class BrandsService { | |
private brandRepo: Repository<Brand>, | ||
) {} | ||
|
||
findOne(id: number) { | ||
findOne(id: number): Promise<Brand> { | ||
return this.brandRepo.findOne(id); | ||
} | ||
|
||
findAll() { | ||
return this.brandRepo.find(); | ||
} | ||
|
||
create(body: any) { | ||
create(body: any): Promise<Brand[]> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tiene que recibir el dto, no un any |
||
const newBrand = this.brandRepo.create(body); | ||
return this.brandRepo.save(newBrand); | ||
} | ||
|
||
async update(id: number, body: any) { | ||
async update(id: number, body: any): Promise<Brand> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. falta tirar un 404 cuando no encuenta el id ademas aca tiene que recibir el dto, no un any |
||
const brand = await this.brandRepo.findOne(id); | ||
this.brandRepo.merge(brand, body); | ||
return this.brandRepo.save(brand); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
falta tirar un 404 cuando no encuentra el brand