Skip to content
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

Propably Wrong Method Signature in EquipmentRepository #4

Closed
oliveirafilipe opened this issue Apr 8, 2020 · 2 comments
Closed

Propably Wrong Method Signature in EquipmentRepository #4

oliveirafilipe opened this issue Apr 8, 2020 · 2 comments

Comments

@oliveirafilipe
Copy link

oliveirafilipe commented Apr 8, 2020

Hi @Melzar, first: Your boilerplate is helping me a lot since it's my first deep dive in all those great architectural techniques.

I'm reading hgraca's article while reading your code

I was going down trough the stack and found this method:

async createEquipment({
name,
userId,
}: CreateEquipmentRequest): Promise<Equipment> {
return this.equipmentRepository.addEquipment(
new AddEquipmentRequest(name, userId)
);
}
}

It is creating an AddEquipmentRequest to pass as parameter, but in the method definition:

async addEquipment({
name,
userId,
}: CreateEquipmentRequest): Promise<Equipment> {

It is expecting CreateEquipmentRequest.

I know that both classes have the same signature:

export class CreateEquipmentRequest {
constructor(public readonly name: string, public readonly userId: string) {}
}

export class AddEquipmentRequest {
constructor(public readonly name: string, public readonly userId: string) {}
}

So, is EquipmentRepository class defining the wrong signature for addEquipment method or am i missing something?

Thank you!

@oliveirafilipe oliveirafilipe changed the title Propably Wrong Type Propably Wrong Method Signature in EquipmentRepository Apr 8, 2020
@Melzar
Copy link
Owner

Melzar commented Apr 27, 2020

Sorry for late response - looks like my mistake, there should be AddEquipmentRequest in as argument in Repository method :). Thanks for catching that I'll provide small patch. @oliveirafilipe

@Melzar
Copy link
Owner

Melzar commented Apr 27, 2020

@oliveirafilipe I've patched that method, I've also introduced a new pattern to the repository which affects this method. Enjoy and thank's for using this repo :) - Closing this issue.

@Melzar Melzar closed this as completed Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants