preetjdp / YouOweMe

Making it simpler to track those chillars
9 stars 6 forks source link

[BUG] Prevent NewOwe On Myself #6

Closed preetjdp closed 4 years ago

preetjdp commented 4 years ago

Describe the bug Currently it is possible to make a NewOwe Mutation on yourself, this needs to be solved.

To Reproduce Steps to reproduce the behavior: This sort of a mutation is allowed and that is a problem.

mutation {
  newOwe(data: {
    title: "Taxi Bill",
    amount: 100,
    issuedToID: "Ei66LhElIZ3eEQeqGBIp"
  }) {
    id
    issuedBy {
      id
      name
    }
  }
}

Expected behavior To return an Error with state's something like 'You cannot make an Owe to yourSelf'

Screenshots image

Additional context Code Snippet in question: https://github.com/preetjdp/YouOweMe/blob/b0b4ae728295c9ca1e9f68920cba069aed21f5d0/server/src/modules/Owe/NewOweResolver.ts#L19-L43

preetjdp commented 4 years ago

Fixed with commit https://github.com/preetjdp/YouOweMe/commit/c4b8fb0af6a51cf90d1e7472714075af665cf9f8

Although the error message does not seem that spectacular to me.

https://github.com/preetjdp/YouOweMe/blob/c4b8fb0af6a51cf90d1e7472714075af665cf9f8/server/src/modules/Owe/NewOweResolver.ts#L31-L33

Closing for now.