mysql - Move information-resource stored in the database tables with two step using 'reservation' -
i need architect database , service, have resource need deliver users. , delivery takes time or requires user more job.
these tables store information into.
table - description _______________________ r - store resources reserve - reserve requested resources hack - track requests couldn`t made client application (statistics) fail - track requests can`t resolved, user isn't guilty (statistics) success - track delivery (statistics)
the first step when user requests resouce
if (condition1 true - user have right request resource) if (i've reserve-d resource , commited transaction) nothing more else save request fail else save request hack
then second step
if (condition2 true - user done job , requests reserved resource) if (the resource delivered successfully) save request success else save request fail depending on application logic move resource reserve r or not else save request hack, contact user, if hacker move resource reserve r
this how think implement system. i've stored transactions procedures. main application logic, decide procedure call done in application/service layer.
am on right way, such code division between db , service layers normal? experienced opinions important.
clarifying , answering recentcoin's questions.
the difference between
hack
,fail
tables store more information inhack
table,user ip
,xff
. i`m not going penalize each user appeared in table. there can 2 reasons user(request) tracked hack. first have bug (mainly in client app) , me fix them. second manually requests, , tries bypass rules. if tries 'harder' i'll able take precautions.the separation of
reserve
,success
tables has these reasons. 2.1. usereserve
table in transactions , queries without usingsuccess
table, can lock them separately. 2.2. data stored insuccess
not slow down queries, wile i'm queryingreserve
table. 2.3.success
table kind of log statistics, can delete or move other database future analyse. 2.4. delete rowsreserve
after move themsuccess
table. can evaluate approximately max rows count in table, because have max limit reservations each user.
the points 2.3 , 2.4 achieved keeping in 1 table. reasons 2.1 , 2.2 enough keep data separately?
- the resource "delivered successfully" mean admin , service done successfully, if couldn't reservation fails
4 , 6. restrictions , right simple, city , country restrictions, users 'flat', don't have roles or hierarchy.
- i have tables store users , information. don't have ldap or ad.
you're going in right direction, there other things need more thought out.
you're going have define constitutes "hack" vs "fail". new systems, users confused , it's pretty easy them make honest mistakes. seems want penalize them in fashion i'd extremely careful this.
you want consider having "reserve" , "success" equivalent. why store same record twice? should have compelling reason that.
you need define "delivered successfully" since entry in calendar getting more pens , post notes.
you want define resources user(s) have rights them. example, may have conference room managers allowed book, might want include managers' administrative assistants in list since booking room manager(s).
do have database of users? ldap or active directory or need create of yourself? if have ldap or ad, can use saml?
6.you going want consider how want assign rights. group based group membership confers rights reserve, request, or use given thing? example, may want architects printing large format printer.
Comments
Post a Comment