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