Mojtabarezaei4 / Queueomatic

A queue system that can be used for educational purposes or for any other situations where prioritization of individuals is necessary.
https://queueomatic.azurewebsites.net/
MIT License
7 stars 2 forks source link

Room validation #45

Closed Mojtabarezaei4 closed 1 year ago

Mojtabarezaei4 commented 1 year ago

Each requested room should validate. Alternative a fluent validation.

FabianAronsson commented 1 year ago

What exactly are we validating?

Mojtabarezaei4 commented 1 year ago

If hashIds that is requesting with does match with any of rooms and also if there is a room with this Id.

Mojtabarezaei4 commented 1 year ago

This should be done in middleware pipeline.

FabianAronsson commented 1 year ago

How come this is not done in the handler? We have to decode the hashid in the handler for the database query regardless. This solution with a middleware implementation would do the same operation twice.

Mojtabarezaei4 commented 1 year ago

For that thought, we can implement a mapper that contains that conversion.

The point of the middleware pipeline will be that it runs before the request hits the handler. Then it will be no need to waste the resources.

FabianAronsson commented 1 year ago

How would this mapper work?

Mojtabarezaei4 commented 1 year ago

A combination of a validator with a mapper.

FabianAronsson commented 1 year ago

Alright, that looks very interesting!

Let's go with that 👍

FabianAronsson commented 1 year ago

Finished in #58