evoluteur / evolutility-models

Sample models, mock data, and scripts to manage models for Evolutility CRUD Apps.
MIT License
10 stars 3 forks source link

how to describe an artist with several photos #1

Closed xu4wang closed 3 years ago

xu4wang commented 3 years ago

Thanks for the amazing project. I like the idea very much, to be able to generate UI and DB automatically based on models.

One questions, from the example model in https://github.com/evoluteur/evolutility-ui-react

In the model of artist, the artist can only have one photo:

{
    "id": "photo",
    "type": "image",
    "label": "Photo",
    "inMany": true,
    "width": 100
},

Is there a way I can adjust the model to support multiple photos(display & edit) for one artist?

BR,Xu

evoluteur commented 3 years ago

With the current implementation you will have to create several fields (photo1, photo2, photo3...). Ideally I would provide a way to specify "array fields" but it is not implemented.

xu4wang commented 3 years ago

With the current implementation you will have to create several fields (photo1, photo2, photo3...). Ideally I would provide a way to specify "array fields" but it is not implemented.

thanks for the clarification.

There will be two scenarios for "array fields",

  1. An artist with multiple photos, user can upload/edit each of the photo.
  2. A product with multiple categories, user can select several categories from a category list for one specific product. The "category list" itself is also an "array fields" of string.

Do you think we should implement the above two scenarios in one field? Or it should be two different "f.type"? I am new to evolutility but I'd like to contribute when I get some idea on how to do that.

evoluteur commented 3 years ago

The case (2) is implemented as field type "list". It is not used in the demo but in the test model. Case (1) would be nice to have. It is most useful for images but maybe could be done for all field types as a new property of fields.

xu4wang commented 3 years ago

The case (2) is implemented as field type "list". It is not used in the demo but in the test model. Case (1) would be nice to have. It is most useful for images but maybe could be done for all field types as a new property of fields.

thanks Will check "list".