-
Notifications
You must be signed in to change notification settings - Fork 3
Create System for Overriding Display of Given Resource Types in Lists #71
Comments
So it looks like we're going to have a number of levels at which the solution to this is going to have to work. I'm going to call this solution the "format provider". We have two levels of data that we need to override formatting for, fields and resources. We also have two methods that we need to override them for. Data
Methods
Does this make sense to you guys? Are there any other cases that you can think of? |
@maxdumas This sounds good. I mean, I doubt these will be the only types of extensibility we'll need down the line (e.g. eventually we're probably going to need many ways to configure the "add" view, from hiding or ordering fields to more dynamic things like #104). But we don't need to try to plan for all that stuff until we actually need it; we can always refactor later. My big question, though, is about something we discussed earlier: whether we're building a tech@nyu-specific intranet or a framework on top of which anyone can build an angular+json-api intranet (with our intranet also being built on top of this framework). I think we should go for the latter, because the marginal costs are low while the benefits to the club's cred and the associated value to the contributors seems high. I ask that question in this context—and it's something I want to talk more about tonight—because it'll have implications for your design above. For example, if someone calls |
Ethan and I discussed this farther and we're going to adapt the approach taken by his ethanresnick/json-api library. We're going to reorganize the customized logic from being services centered around functions for all resources to being services centered around resources for all their functions. In this system, for each resource that we want to define custom logic for, we would supply a custom service that would specify everything, with some other service providing sensible default values, either through lookup or through inheritance. |
Right now we just have a series of fallbacks hardcoded, currently going
name || title || schoolName || id
. This obviously isn't the most robust way to handle this, and its fails to account for types that require or desire more complex representation as strings.A good example of this is Venue, for which we want to display the address as well as the name.
Another example is a TeamMembership. Currently all we show for that is its ID, as it doesn't really have any field that clearly maps to a string.
This is something that we should determine on the front end and not on the API side, as it will be application-specific.
The text was updated successfully, but these errors were encountered: