GroceriStar / types

GNU General Public License v3.0
0 stars 4 forks source link

[ChickenKyiv][types] #7

Closed atherdon closed 5 years ago

atherdon commented 6 years ago

You'll convert Database table into pseudo-type code. Later it'll be converted in ReasonML language.

[This is a place where we defined our models for this API Server] (https://github.com/ChickenKyiv/recipe-api-only/tree/master/server/models) So for each of this models we should move the main logic into a separated place. Example - looking at Allergy Model(Allergy.json)

{
  "name": "Allergy",
  "plural": "allergy",
  "base": "PersistedModel",
  "idInjection": true,
  "options": {
    "validateUpsert": true
  },
  "properties": {
    "name": {
      "type": "string",
      "required": true
    },

    "type": {
      "type": "string",
      "required": true
    }
  },
  "validations": [],
  "relations": {},
  "acls": [],
  "methods": {}
}

from that spefication we'll grab only properties and name. The end result is below:

const allergy = {
   name: "String",
   type: "String"
};