Data modeling question

前端 未结 3 1065
耶瑟儿~
耶瑟儿~ 2020-12-21 17:45

My clients use one of the following when they sign up for my application:

  1. Foo API (requires a \"auth_key\", \"passwor
3条回答
  •  臣服心动
    2020-12-21 17:51

    I would probably prefer to do this with a single table itself

    Have a single UserAuthentication table with columns like IdentificationKey, AuthenticationCriteria1, AuthenticationCriteria2 and so on...

    Number of AuthenticationCriteriaX columns = maximum number of criteria that any API will have. I am assuming it will be something reasonable like maybe 5 at the most but anything upto 15-20 is actually still is a pretty small table.

    UserAuthentication table also has a api_key column which is a foreign key from an MASTER_API table which is the list of all supported API's

    As for the UI part of the problem, i.e what label to show the user for any field from the UserAuthentication table, i think that is just a UI concern and as such you should just have the mapping specific to each api somewhere in your UI layer. The api_key column can be used for the translation as needed. The DB does not necessarily need to know those details, IMO.

提交回复
热议问题