Start working on the Stats Viewer application
This commit is contained in:
parent
cb3bc7c86c
commit
91863d85a8
18 changed files with 422 additions and 1 deletions
36
module/utils/databases/UserFlag.mjs
Normal file
36
module/utils/databases/UserFlag.mjs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
import { Table } from "./model.mjs";
|
||||
|
||||
const tablesFlag = `tables`;
|
||||
|
||||
export class UserFlagDatabase {
|
||||
static getTables() {
|
||||
/** @type {Array<{ name: string; }>} */
|
||||
const tableConfig = game.settings.get(__ID__, `tables`);
|
||||
return tableConfig ?? [];
|
||||
};
|
||||
|
||||
static createRow(table, user, row) {};
|
||||
|
||||
static getRows(tableId, ...users) {
|
||||
if (users.length === 0) { users = [game.user] };
|
||||
|
||||
const datasets = {};
|
||||
for (const user of users) {
|
||||
const tables = user.getFlag(__ID__, tablesFlag) ?? {};
|
||||
if (tables[tableId] === undefined) {
|
||||
datasets[user.id] = null;
|
||||
continue;
|
||||
};
|
||||
|
||||
const table = new Table(tables[tableId]);
|
||||
}
|
||||
return datasets;
|
||||
};
|
||||
|
||||
static updateRow(table, user, rowId, changes) {};
|
||||
|
||||
static deleteRow(table, user, rowId) {};
|
||||
};
|
||||
|
||||
/* eslint-enable no-unused-vars */
|
||||
Loading…
Add table
Add a link
Reference in a new issue