-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrelease.ts
More file actions
25 lines (23 loc) · 840 Bytes
/
release.ts
File metadata and controls
25 lines (23 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import ReleasesFactory from '../models/releaseFactory';
export default {
Query: {
/**
* Fetch releases by projectId
* @param {ResolverObj} _ - Parent object, not used
* @param {ResolverArgs} args - Query arguments containing required projectId
* @param {ContextFactories} context - Global GraphQL context with factories
* @returns {Promise<Release[]>}
*/
getReleases: async (_: any, args: { projectId: string }, { factories }: any) => {
if (!args.projectId) {
throw new Error('projectId is required to fetch releases');
}
try {
return await factories.releasesFactory.findManyByProjectId(args.projectId);
} catch (error) {
console.error('Error fetching releases:', error);
throw new Error('Failed to get the releases');
}
},
},
};