C
C#•12mo ago
thomas

Model to DTO

Does this make sense?
No description
18 Replies
thomas
thomasOP•12mo ago
My DB looks like this
No description
Denis
Denis•12mo ago
ISBN is a 13 digit code Int stores up to 10 digit numbers
Pobiega
Pobiega•12mo ago
imho it makes no sense to store an ISBN as an int its a bit like a phonenumber, its a number, but you never use it as a number you dont do math on it, or ordinal comparison other than that, seems fine? your DTO is just a subset of your entity, so no complicated mapping required
Denis
Denis•12mo ago
Indeed you do not do math on it... But amount of space in the int for representing an isbn seems to be insufficient? I'll double check, but what if you get a full 13 digit code where the first number is greater than 4 (to account for unsigned int) I'd say long or string (with charmax(13)) might be better
Denis
Denis•12mo ago
Stack Overflow
What is the best data type for ISBN10 and ISBN13 in a MySQL database
For an application I'm currently building I need a database to store books. The schema of the books table should contain the following attributes: id, isbn10, isbn13, title, summary What data types
Denis
Denis•12mo ago
string is best suited for isbn, based on this post. Which makes sense, as int would trim, and long is longer than needed
Pobiega
Pobiega•12mo ago
Yeah, I would recommend strings for ISBNs, personal identity numbers, phonenumbers etc
Sir Rufo
Sir Rufo•12mo ago
ISBN is a collection of digits and could also contain leading zeros
Pobiega
Pobiega•12mo ago
another good reason for not using a numeric type🙂
Sir Rufo
Sir Rufo•12mo ago
I faced some problems with a POS when they stored ZipCodes as numerics and I was not able to filter out mistyped ZipCodes. 1234 could be wrong or 01234 - who knows? Or it could be valid because it was a foreign ZipCode
Denis
Denis•12mo ago
Also I wouldn't use the isbn as an id for a book. Afaik a single book can have more than one isbn So use your own incremental primary key. You'd have to do the same for users. Using someones government id number was proved to also be an unreliable primary key
thomas
thomasOP•12mo ago
true but it's a uni project fr, i'll just make some little assumptions alright
Pobiega
Pobiega•12mo ago
(not so) fun fact, these government IDs can change due to protected identities, judicial sex change etc. A friend of mine went through this and it was a nightmare in some systems, as they simply didn't support changing it on an existing customer and essentially had to create a new account and "try to migrate" the data over.
Denis
Denis•12mo ago
Well, at least you can see how much you need to research, even for something as simple as a book db... But I'd understand if you decide to not include these suggestions for a uni project Government is cutting edge
thomas
thomasOP•12mo ago
Cause it's actually something a lil more complicated than this i have to build a microservice based application
thomas
thomasOP•12mo ago
like this is just a microservice
No description
Denis
Denis•12mo ago
Well, all the best with the project! $close
MODiX
MODiX•12mo ago
Use the /close command to mark a forum thread as answered
Want results from more Discord servers?
Add your server