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.

  1. the difference between hack , fail tables store more information in hack 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.

  2. the separation of reserve , success tables has these reasons. 2.1. use reserve table in transactions , queries without using success table, can lock them separately. 2.2. data stored in success not slow down queries, wile i'm querying reserve table. 2.3. success table kind of log statistics, can delete or move other database future analyse. 2.4. delete rows reserve after move them success 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?

  1. 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.

  1. 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.

  1. 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.

  2. you want consider having "reserve" , "success" equivalent. why store same record twice? should have compelling reason that.

  3. you need define "delivered successfully" since entry in calendar getting more pens , post notes.

  4. 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).

  5. 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

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -