Update getAll() to return status codes.
This commit is contained in:
parent
0c002edefa
commit
fca17a796d
@ -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 };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user