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