Start implementing the stuff that AERC requests as part of Email/get
This commit is contained in:
parent
dada829e6e
commit
bf3beba458
2 changed files with 33 additions and 0 deletions
24
migrations/20250123043534_messageKeywords.js
Normal file
24
migrations/20250123043534_messageKeywords.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
/**
|
||||
* @param { import("knex").Knex } knex
|
||||
* @returns { Promise<void> }
|
||||
*/
|
||||
exports.up = async function(knex) {
|
||||
await knex.schema.createTable("keywords", (table) => {
|
||||
table.increments("id", {primaryKey: true});
|
||||
table.integer("messageState");
|
||||
table.string("keyword");
|
||||
});
|
||||
|
||||
const messages = await knex("messages").select().where("read", "=", true);
|
||||
await Promise.all(messages.map(async (row) => {
|
||||
await knex("keywords").insert({messageState: row.state, keyword: "$seen"});
|
||||
}));
|
||||
};
|
||||
|
||||
/**
|
||||
* @param { import("knex").Knex } knex
|
||||
* @returns { Promise<void> }
|
||||
*/
|
||||
exports.down = function(knex) {
|
||||
return knex.schema.dropTable("keywords");
|
||||
};
|
|
@ -232,6 +232,15 @@ app.post("/api/jmap/api/", bodyParser.json(), async (req, res) => {
|
|||
]
|
||||
}
|
||||
}
|
||||
// {
|
||||
// "using":["urn:ietf:params:jmap:mail"],
|
||||
// "methodCalls":[["Email/get",{
|
||||
// "ids":["1","12","2","3","4","5","6","7","8","9"],
|
||||
// "properties":["id","blobId","mailboxIds","keywords","size","receivedAt","headers","messageId","inReplyTo","references","from","to","cc","bcc","replyTo","subject","bodyStructure"]},"0"]]}
|
||||
// id: state
|
||||
// blobId: state
|
||||
// mailboxIds: {INBOX: true} // TODO: Implement more mailboxes.
|
||||
// keywords: keywords table, {keyword_column: true}
|
||||
|
||||
return [
|
||||
"error",
|
||||
|
|
Loading…
Add table
Reference in a new issue