-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrelease.ts
More file actions
24 lines (23 loc) · 863 Bytes
/
release.ts
File metadata and controls
24 lines (23 loc) · 863 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
import ReleasesFactory from '../models/releaseFactory';
export default {
Query: {
/**
* Fetch all releases or releases filtered by projectId
* @param {ResolverObj} _ - Parent object, not used
* @param {ResolverArgs} args - Query arguments
* @param {ContextFactories} context - Global GraphQL context with factories
* @returns {Promise<Release[]>}
*/
getReleases: async (_: any, args: { projectId?: string }, { factories }: any) => {
try {
if (args.projectId) {
return await factories.releasesFactory.getReleasesByProjectId(args.projectId);
}
return await factories.releasesFactory.getAllReleases();
} catch (error) {
console.error('Error fetching releases:', error);
throw new Error('Не удалось получить релизы');
}
},
},
};