Update getAll() to return status codes.

This commit is contained in:
themodrnhakr 2025-09-28 16:11:25 -05:00
parent 0c002edefa
commit fca17a796d

View File

@ -13,16 +13,16 @@ class TasksService {
public async getAll() { public async getAll() {
logger.info("Fetching all task records..."); logger.info("Fetching all task records...");
try { try {
const result = await this.db.query.tasks.findMany({ const tasks = await this.db.query.tasks.findMany({
with: { with: {
type: true, type: true,
}, },
}); });
logger.debug(`Found ${result.length} records.`); logger.debug(`Found ${tasks.length} records.`);
return result; return { tasks, status: "ok" };
} catch (e) { } catch (error) {
logger.error({ msg: "Error querying the database.", error: e }); logger.error({ msg: "Error querying the database.", error });
return false as const; return { status: "failed", error };
} }
} }