Skip to content

Commit 269b952

Browse files
authored
feat: Labels on proposal (#449)
* feat: Labels on proposal * fixes
1 parent e3f11ff commit 269b952

File tree

4 files changed

+5
-0
lines changed

4 files changed

+5
-0
lines changed

src/ingestor.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ export default async function ingestor(req) {
143143
body: message.body,
144144
discussion: message.discussion || '',
145145
choices: message.choices,
146+
labels: message.labels || [],
146147
start: message.start,
147148
end: message.end,
148149
snapshot: message.snapshot,
@@ -169,6 +170,7 @@ export default async function ingestor(req) {
169170
body: message.body,
170171
discussion: message.discussion || '',
171172
choices: message.choices,
173+
labels: message.labels || [],
172174
metadata: {
173175
plugins: JSON.parse(message.plugins)
174176
},

src/writer/proposal.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ export async function action(body, ipfs, receipt, id): Promise<void> {
233233
body: msg.payload.body,
234234
discussion: msg.payload.discussion || '',
235235
choices: JSON.stringify(msg.payload.choices),
236+
labels: msg.payload.labels?.length ? JSON.stringify(msg.payload.labels) : null,
236237
start: parseInt(msg.payload.start || '0'),
237238
end: parseInt(msg.payload.end || '0'),
238239
quorum,

src/writer/update-proposal.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ export async function action(body, ipfs): Promise<void> {
7373
body: msg.payload.body,
7474
discussion: msg.payload.discussion,
7575
choices: JSON.stringify(msg.payload.choices),
76+
labels: msg.payload.labels?.length ? JSON.stringify(msg.payload.labels) : null,
7677
scores: JSON.stringify([]),
7778
scores_by_strategy: JSON.stringify([]),
7879
flagged: +containsFlaggedLinks(msg.payload.body)

test/schema.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ CREATE TABLE proposals (
4545
body MEDIUMTEXT NOT NULL,
4646
discussion TEXT NOT NULL,
4747
choices JSON NOT NULL,
48+
labels JSON DEFAULT NULL,
4849
start INT(11) NOT NULL,
4950
end INT(11) NOT NULL,
5051
quorum DECIMAL(64,30) NOT NULL,

0 commit comments

Comments
 (0)