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() {
logger.info("Fetching all task records...");
try {
const result = await this.db.query.tasks.findMany({
const tasks = await this.db.query.tasks.findMany({
with: {
type: true,
},
});
logger.debug(`Found ${result.length} records.`);
return result;
} catch (e) {
logger.error({ msg: "Error querying the database.", error: e });
return false as const;
logger.debug(`Found ${tasks.length} records.`);
return { tasks, status: "ok" };
} catch (error) {
logger.error({ msg: "Error querying the database.", error });
return { status: "failed", error };
}
}