git ssb

3+

arj / patchbook



Tree: 4eca0ed30e252fb6ab238b16b95d660c239aacca

Files: 4eca0ed30e252fb6ab238b16b95d660c239aacca / book / obs / struct.js

912 bytesRaw
1const nest = require('depnest')
2const { Value, Set, Dict, Struct, forEachPair } = require('mutant')
3
4exports.needs = nest({
5 'sbot.async.publish': 'first'
6})
7
8exports.gives = nest('book.obs.struct')
9
10exports.create = function (api) {
11 return nest('book.obs.struct', function (opts = {}) {
12 const struct = Struct({
13 key: Value(''),
14 title: Value(''),
15 authors: Value(''),
16 description: Value(''),
17 images: Set([]),
18 subjective: Dict()
19 })
20
21 struct.create = function(cb)
22 {
23 let s = struct()
24
25 let commonObj = {
26 title: s.title,
27 authors: s.authors,
28 description: s.description,
29 images: s.images
30 }
31 let subjectiveObj = null
32
33 api.sbot.async.publish({ type: 'bookclub',
34 common: commonObj,
35 subjective: subjectiveObj }, cb)
36 }
37
38 return struct
39 })
40}
41

Built with git-ssb-web