Skip to content

Commit 32db67e

Browse files
committed
base - inline fields to own type
1 parent a5e90df commit 32db67e

File tree

1 file changed

+29
-12
lines changed

1 file changed

+29
-12
lines changed

api.ts

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,18 @@ export interface Fresh {
1313
name: string;
1414
description?: string;
1515

16-
owner: ItemId;
17-
group: ItemId;
16+
owner?: ItemId;
17+
group?: ItemId;
1818
}
1919

20-
export type Staged = Fresh & {
20+
export interface Base {
2121
_id: ItemId;
22-
};
22+
name: string;
23+
description?: string;
2324

24-
export type Base = Staged;
25+
owner?: ItemId;
26+
group?: ItemId;
27+
}
2528

2629

2730
/* ----- api/v1/models ----- */
@@ -119,10 +122,11 @@ export type MqttState = {
119122
payload: string;
120123
};
121124

122-
export type State = ServiceState &
123-
GpsState &
124-
MqttState &
125-
GeometryState & {
125+
export type State = ServiceState
126+
& GpsState
127+
& MqttState
128+
& GeometryState
129+
& {
126130
[argumentId: string]: number | boolean | string;
127131
};
128132

@@ -138,7 +142,7 @@ export interface RicObject<TState = State, TConfig = Config> extends Base {
138142
id: string;
139143
model: ItemId;
140144

141-
state?: TState;
145+
state?: Readonly<TState>;
142146
config?: TConfig;
143147
}
144148

@@ -174,7 +178,8 @@ export type GeographyType =
174178
| "marker"
175179
| "circle"
176180
| "rectangle"
177-
| "route";
181+
| "route"
182+
| string;
178183

179184
export type Geopoint = {
180185
type: "marker" | "circle";
@@ -186,9 +191,21 @@ export type Geoline = {
186191
points: Geography[];
187192
};
188193

194+
export type Waypoint = {
195+
center: Geography;
196+
name: string;
197+
check?: boolean;
198+
};
199+
200+
export type GeorouteTrip = {
201+
type: "direct" | "return";
202+
points: Geography[];
203+
waypoints: Waypoint[];
204+
};
205+
189206
export type Georoute = {
190207
type: "route";
191-
path: { name: string; geoline: string }[];
208+
trips: GeorouteTrip[];
192209
};
193210

194211
export type Geoshape = Geopoint | Geoline | Georoute;

0 commit comments

Comments
 (0)