blob: f4d8ce4b23d0fc7ab9c38ff187c7580e56fb5956 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
import { withKeys } from 'test_helpers/utils/obj';
export default server => {
server.get('/api/v4/projects/:id', (schema, request) => {
const { id } = request.params;
const proj =
schema.projects.findBy({ id }) ?? schema.projects.findBy({ path_with_namespace: id });
return proj.attrs;
});
server.get('/api/v4/projects/:id/merge_requests', (schema, request) => {
const result = schema.mergeRequests.where(
withKeys(request.queryParams, {
source_project_id: 'project_id',
source_branch: 'source_branch',
}),
);
return result.models;
});
};
|