feat(dm): more stats

This commit is contained in:
Samuel 2024-12-18 16:52:46 +01:00
parent d9268a4991
commit dbd0b12b3d
No known key found for this signature in database
19 changed files with 798 additions and 1106 deletions

36
src/types.ts Normal file
View file

@ -0,0 +1,36 @@
export type MessageOverview =
| {
messageDate: Date;
fromRecipientId: number;
}[]
| undefined;
export type Recipients = {
recipientId: number;
name: string;
}[];
export type MessageStats = {
// indexed by recipientId
person: {
[recipientId: number]: number;
};
// month from 0 to 11 = from January to December, each month indexed by recipientId
month: {
[recipientId: number]: number;
}[];
// every date of the chat history, indexed by the date string
date: {
[recipientId: number]: number;
date: Date;
totalMessages: number;
}[];
// weekdays from 0 to 6 = from Monday to Sunday (not from Sunday to Saturday as in the `Date` object), each weekday indexed by recipientId
weekday: {
[recipientId: number]: number;
}[];
// hours of the day from 0 - 23, each hour indexed by recipientId
daytime: {
[recipientId: number]: number;
}[];
};