CommonGarden / Grow-IoT

Software packages for smart growing environments.
http://commongarden.org/
Other
25 stars 6 forks source link

Environments (a.k.a. groups of things) #311

Open JakeHartnell opened 7 years ago

JakeHartnell commented 7 years ago

Environments are simply a collection of things.

An environment such as a grow room or greenhouse might contain the following:

Environments are ways to group things together.

apengwin commented 7 years ago

Hey @JakeHartnell . I'm starting to take a look at this, and was wondering how environments should be implemented. Are they simply a collection of constants?

JakeHartnell commented 7 years ago

Are they simply a collection of constants?

Yes.

I think it would be simply be an extension of the thing schema. See: https://github.com/aruntk/grow-graphql-api/blob/master/src/schema/things.js

We could modify it to have something like a contains property which would be a list of subthings! Just an idea.

export const ThingSchema = [`
type subThings {
   // a list of things.
}
scalar Date
type Thing {
  _id: String!
  uuid: String!
  token: String,
  owner: String,
  component: String,
  name : String,
  onlineSince: Boolean,
  contains: subThings,
  properties: Object,
  registeredAt: Date
}
`,
];

Eventually we'll need some UI for grouping things into "Environments".

JakeHartnell commented 7 years ago

We're going to be switching to GraphQL soon #315, I'm currently reading through this: http://graphql.org/learn/queries/

apengwin commented 7 years ago

gotcha. Should the code for environment be defined in Grow.js then?