Farmbot-Web-App/frontend/farm_designer/plant.ts

23 lines
647 B
TypeScript
Raw Normal View History

2017-06-29 12:54:02 -06:00
import { PlantOptions } from "./interfaces";
2018-08-02 15:46:58 -06:00
import { PlantPointer } from "farmbot/dist/resources/api_resources";
2017-06-29 12:54:02 -06:00
export const DEFAULT_PLANT_RADIUS = 25;
/** Factory function for Plant types. */
export function Plant(options: PlantOptions): PlantPointer {
2017-08-28 05:49:13 -06:00
const openfarm_slug = options.openfarm_slug || "not-set";
2017-06-29 12:54:02 -06:00
return {
id: options.id,
pointer_type: "Plant",
created_at: (options.created_at || ""),
name: (options.name || "Untitled Plant"),
meta: {},
x: (options.x || 0),
y: (options.y || 0),
z: 0,
radius: (options.radius || DEFAULT_PLANT_RADIUS),
2018-03-05 10:15:56 -07:00
openfarm_slug,
plant_stage: "planned"
2017-06-29 12:54:02 -06:00
};
}