@@ -10,7 +10,7 @@ All fields, except simple arrays of a primitives (ie. `number`, `number[]` etc),
1010
1111Related: [ story: AP reservation overview] ( https://github.com/windingtree/win-stays/issues/17 )
1212
13- Identify what * queries * must be able to be answered from the database:
13+ Identify what _ queries _ must be able to be answered from the database:
1414
15151 . How to get information relating to a booking?
16162 . How to get what bookings are staying at an accommodation facility on a specific day?
@@ -30,7 +30,7 @@ Description: A list of facilities that are handled by this `lpms-server`.
3030
3131### facilities
3232
33- Parent level: * root *
33+ Parent level: _ root _
3434Level: ` facilityId ` (dynamic)
3535
3636Key: ` metadata `
@@ -174,7 +174,7 @@ Level: `stubs`
174174
175175Key: ` YYYY-MM-DD ` (dynamic)
176176Value: ` string[] `
177- Description: Contains a list of all stubs, ie. ` stubId ` (bookings) that are on the date YYYY-MM-DD in this ` spaceId ` .
177+ Description: Contains a list of all stubs, ie. ` stubId ` (bookings) that are on the date YYYY-MM-DD in this ` spaceId ` .
178178Notes: This meets the requirement (3)
179179
180180Key: ` YYYY-MM-DD-num_booked ` (dynamic)
@@ -210,25 +210,27 @@ Description: Contains generic data for the item (name, photos, etc)
2102104 . Find number of spaces (rooms) booked by date: ` facilityId.spaceId.stubs.YYYY-MM-DD-num_booked ` .
2112115 . Determine if a space can be booked on a given day:
212212
213- With daily availability override:
213+ With daily availability override:
214214
215- ` Ask.numSpacesReq <= (facilityId.spaceId.availability.YYYY-MM-DD - facilityId.spaceId.YYYY-MM-DD-num_booked) `
215+ ` Ask.numSpacesReq <= (facilityId.spaceId.availability.YYYY-MM-DD - facilityId.spaceId.YYYY-MM-DD-num_booked) `
216216
217- With no daily availability override:
217+ With no daily availability override:
218218
219- ` Ask.numSpacesReq <= (facilityId.spaceId.availability.default - facilityId.spaceId.YYYY-MM-DD-num_booked) `
219+ ` Ask.numSpacesReq <= (facilityId.spaceId.availability.default - facilityId.spaceId.YYYY-MM-DD-num_booked) `
220+
221+ This meets the requirement of (5)
220222
221- This meets the requirement of (5)
2222236 . Determine if a space can be booked for a date range:
223224
224- ``` python
225- for day in date_range:
226- # isAvailable = logic from (5) above
227- if (! isAvailable)
228- return false
229- return true
230- ```
231- This meets the requirement of (6 )
225+ ``` python
226+ for day in date_range:
227+ # isAvailable = logic from (5) above
228+ if (! isAvailable)
229+ return false
230+ return true
231+ ```
232+
233+ This meets the requirement of (6)
232234
233235### Update
234236
@@ -243,40 +245,39 @@ Description: Contains generic data for the item (name, photos, etc)
243245In order to generate the final ` metadata ` binary glob that is uploaded to ` IPFS ` :
244246
245247``` typescript
246-
247- let items: ServiceItemData[]
248+ let items: ServiceItemData [];
248249
249250// process all spaces
250- const spaces = db.get(' facilityId.spaces' ) // insert correct leveldb query here
251+ const spaces = db .get (' facilityId.spaces' ); // insert correct leveldb query here
251252for (const space of object ) {
252- // get generic metadata
253- const generic = db.get(`$ {facilityId}.$ {space}.metadata_generic` ) as Item
254- const specific = db.get(`$ {facilityId}.$ {space}.metadata` ) as Space
255- generic.payload = Space.toBinary(specific)
256-
257- items.push({
258- item: utils.arrayify(utils.formatBytes32String(space)),
259- payload: Item.toBinary(generic)
260- })
253+ // get generic metadata
254+ const generic = db .get (` ${facilityId }.${space }.metadata_generic ` ) as Item ;
255+ const specific = db .get (` ${facilityId }.${space }.metadata ` ) as Space ;
256+ generic .payload = Space .toBinary (specific );
257+
258+ items .push ({
259+ item: utils .arrayify (utils .formatBytes32String (space )),
260+ payload: Item .toBinary (generic )
261+ });
261262}
262263
263264// process all other items
264- const otherItems = db.get(' facilityId.otherItems' ) as Item[]
265+ const otherItems = db .get (' facilityId.otherItems' ) as Item [];
265266for (const item of otherItems ) {
266- const otherItem = db.get(`$ {facilityId}.otherItems.$ {item}` ) as Item
267- items.push({
268- item: utils.arrayify(utils.formatBytes32String(item)),
269- payload: Item.toBinary(otherItem)
270- })
267+ const otherItem = db .get (` ${facilityId }.otherItems.${item } ` ) as Item ;
268+ items .push ({
269+ item: utils .arrayify (utils .formatBytes32String (item )),
270+ payload: Item .toBinary (otherItem )
271+ });
271272}
272273
273274// assemble the metadata for signing / publishing
274275const serviceProviderData: ServiceProviderData = {
275- serviceProvider: utils.arrayify(utils.formatBytes32String(' provider' )),
276- payload: Facility.toBinary(db.get(`$ facilityId.metadata` )),
277- items: items,
278- terms: []
279- }
276+ serviceProvider: utils .arrayify (utils .formatBytes32String (' provider' )),
277+ payload: Facility .toBinary (db .get (` $facilityId.metadata ` )),
278+ items: items ,
279+ terms: []
280+ };
280281```
281282
282283# Todo
0 commit comments