Skip to content

Commit bb1606a

Browse files
author
Gutierrez, Andres
committed
Update log message
1 parent 73fefce commit bb1606a

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

src/resolvers/apis/dal.js

+31-31
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
1-
import { dbc, ObjectId, withErrorHandler, logger } from "../../infrastructure";
2-
3-
const searchAllApis = async (limit = null, next = 0) => {
4-
logger.debug(`Calling to db -> get all responses`);
5-
if (limit !== null) {
6-
return await dbc.apis.find({})
7-
.skip(next)
8-
.limit(limit)
9-
.toArray();
10-
}
11-
return await dbc.apis.find({}).toArray();
12-
};
13-
14-
const searchAnApi = async (apiIds) => {
15-
logger.debug(`Calling to db -> Get api: ${apiIds}`);
16-
if (!Array.isArray(apiIds)) {
17-
apiIds = [apiIds];
18-
}
19-
20-
const listObjectIds = apiIds.map((id) => ObjectId(id));
21-
return await dbc.apis.find({ _id: { $in: listObjectIds } }).toArray();
22-
};
23-
24-
const countApis = async () => await dbc.apis.countDocuments({});
25-
26-
27-
export default {
28-
searchAllApis: withErrorHandler(searchAllApis),
29-
searchAnApi: withErrorHandler(searchAnApi),
30-
countApis: withErrorHandler(countApis),
31-
};
1+
import { dbc, ObjectId, withErrorHandler, logger } from "../../infrastructure";
2+
3+
const searchAllApis = async (limit = null, next = 0) => {
4+
logger.debug(`Calling to db -> get all apis`);
5+
if (limit !== null) {
6+
return await dbc.apis.find({})
7+
.skip(next)
8+
.limit(limit)
9+
.toArray();
10+
}
11+
return await dbc.apis.find({}).toArray();
12+
};
13+
14+
const searchAnApi = async (apiIds) => {
15+
logger.debug(`Calling to db -> Get api: ${apiIds}`);
16+
if (!Array.isArray(apiIds)) {
17+
apiIds = [apiIds];
18+
}
19+
20+
const listObjectIds = apiIds.map((id) => ObjectId(id));
21+
return await dbc.apis.find({ _id: { $in: listObjectIds } }).toArray();
22+
};
23+
24+
const countApis = async () => await dbc.apis.countDocuments({});
25+
26+
27+
export default {
28+
searchAllApis: withErrorHandler(searchAllApis),
29+
searchAnApi: withErrorHandler(searchAnApi),
30+
countApis: withErrorHandler(countApis),
31+
};

0 commit comments

Comments
 (0)