Add archive metadata schema, RS type

This commit is contained in:
Basti 2021-11-04 13:18:55 +01:00
parent 9f477ba14b
commit cd93cd4167
Signed by untrusted user: basti
GPG Key ID: 9F88009D31D99C72

View File

@ -14,7 +14,7 @@ function parseDate (date) {
const ChatMessages = function (privateClient, publicClient) {
/**
* Schema: chat-messages/daily
* Schema: chat-messages/daily-archive
*
* Represents one calendar day of chat messages
*
@ -144,6 +144,51 @@ const ChatMessages = function (privateClient, publicClient) {
privateClient.declareType("daily-archive", "https://kosmos.org/ns/v2", archiveSchema);
publicClient.declareType("daily-archive", "https://kosmos.org/ns/v2", archiveSchema);
/**
* Schema: chat-messages/daily-archive-meta
*
* Stores meta information about the daily archives
*
* @example
* {
* "@context": "https://kosmos.org/ns/v2",
* "@id": "chat-messages/irc.libera.chat/channels/kosmos/meta",
* "@type": "ChatChannelMetadata",
* "first": "2009/01/03",
* "last": "2021/11/05"
* }
* }
*/
const archiveMetaSchema = {
"type": "object",
"properties": {
"@context": {
"type": "string",
"default": "https://kosmos.org/ns/v2",
"enum": ["https://kosmos.org/ns/v2"]
},
"@id": {
"type": "string",
},
"@type": {
"type": "string",
"default": "ChatChannel",
"enum": ["ChatChannel"]
},
"first": {
"type": "string",
"pattern": "^[0-9]{4}\/[0-9]{2}\/[0-9]{2}$"
},
"last": {
"type": "string",
"pattern": "^[0-9]{4}\/[0-9]{2}\/[0-9]{2}$"
}
},
"required": ["@id", "first", "last"]
};
privateClient.declareType("daily-archive-meta", "https://kosmos.org/ns/v2", archiveMetaSchema);
/**
* A daily archive stores chat messages by calendar day.
*
@ -537,6 +582,13 @@ const ChatMessages = function (privateClient, publicClient) {
});
}
_createArchiveMetaDocument () {
}
_updateArchiveMetaDocument () {
}
/*
* Write archive document
*