Make it clearer what arguments are IDs and which aren't

This commit is contained in:
Oliver-Akins 2025-05-19 01:38:35 -06:00
parent 6dbc0a817f
commit abc4b1d2ed

View file

@ -1,4 +1,5 @@
/* eslint-disable no-unused-vars */ /* eslint-disable no-unused-vars */
import { PrivacyMode } from "../privacy.mjs";
import { validateBucketConfig } from "../buckets.mjs"; import { validateBucketConfig } from "../buckets.mjs";
/* /*
@ -39,14 +40,14 @@ export class Database {
if (name.split(`/`).length > 2) { if (name.split(`/`).length > 2) {
ui.notifications.error(`Subtables are not able to have subtables`); ui.notifications.error(`Subtables are not able to have subtables`);
return false; return false;
} };
const tables = game.settings.get(__ID__, `tables`); const tables = game.settings.get(__ID__, `tables`);
const [ table, subtable ] = name.split(`/`); const [ table, subtable ] = name.split(`/`);
if (subtable && tables[table]) { if (subtable && tables[table]) {
ui.notifications.error(`Cannot add subtable for a table that already exists`); ui.notifications.error(`Cannot add subtable for a table that already exists`);
return false; return false;
} };
if (tables[name]) { if (tables[name]) {
ui.notifications.error(`Cannot create table that already exists`); ui.notifications.error(`Cannot create table that already exists`);
@ -127,23 +128,23 @@ export class Database {
}; };
// MARK: Row Ops // MARK: Row Ops
static async createRow(table, userID, row, opts) { static async createRow(tableID, userID, row, opts) {
throw new Error(`createRow() must be implemented`); throw new Error(`createRow() must be implemented`);
}; };
static async createRows(table, userID, rows, opts) { static async createRows(tableID, userID, rows, opts) {
throw new Error(`createRows() must be implemented`); throw new Error(`createRows() must be implemented`);
}; };
static async getRows(tableID, userIDs, privacy = `none`) { static async getRows(tableID, userIDs, privacy = [PrivacyMode.PUBLIC]) {
throw new Error(`getRows() must be implemented`); throw new Error(`getRows() must be implemented`);
}; };
static async updateRow(table, userID, rowID, changes) { static async updateRow(tableID, userID, rowID, changes) {
throw new Error(`updateRow() must be implemented`); throw new Error(`updateRow() must be implemented`);
}; };
static async deleteRow(table, userID, rowID) { static async deleteRow(tableID, userID, rowID) {
throw new Error(`deleteRow() must be implemented`); throw new Error(`deleteRow() must be implemented`);
}; };
@ -191,6 +192,8 @@ export class Database {
*/ */
static async registerListeners() {}; static async registerListeners() {};
static async triggerListeners() {};
static async unregisterListeners() {}; static async unregisterListeners() {};
}; };