jaduff / LabLog

Software for recording physical users of computers in a lab environment.
MIT License
0 stars 1 forks source link

Room names can be duplicated #20

Closed jaduff closed 6 years ago

jaduff commented 7 years ago

A room name must be unique. Two rooms can have their names swapped, so they still need a GUID. But no two rooms can have the same name simultaneously.

simonjduff commented 7 years ago

Maybe it is that the model is wrong then. Perhaps the aggregate root is School and you add computers to a room in a school, and record damage by students in a school on computers in a room in a school.

jaduff commented 7 years ago

Perhaps I am thinking about this wrong. Two physical rooms don't have the same name, so two rooms in the domain also shouldn't. But this isn't "can't". Someone could put the same room name on two rooms, but don't, because its not helpful. Following the same idea, it is up to the person doing the data entry to avoid this problem. So rather than having it as a domain issue, with Write Model validation checking, it could be left up to the interface to suggest that this is a bad idea. So it could be possible to create two rooms, but ill-advised.

jaduff commented 6 years ago

Except I wanted to use Admin/room/ Admin/room/ would be easier, but rather less useful. So the problem is that to have the path structure I want, rooms need to be able to be selected by their name, and the names must therefore be unique. Is it even possible?

simonjduff commented 6 years ago

This isn't ideal for a couple of reasons. If rooms can be renamed, then they aren't the identity of the entity. This is why we have a Guid. -Problems this can cause are: people having deep links -SEO

A common solution is to combine an identifier and the name, using "Url Rewriting". Admin/123-45-95-2-ComputerScienceRoom So we both have the id and a friendly name

jaduff commented 6 years ago

Does URL Rewriting need to be done manually through routes? Or is there an automatic translation process? Everything I've been able to find is about manually specified routes.

jaduff commented 6 years ago

Or could I use the template? template: "{controller=Admin}/{action=Index}/{id?}/{Name?}"

simonjduff commented 6 years ago

That would work yes