Skip to content

Commit 7e075c0

Browse files
merge release with project
1 parent e15dec2 commit 7e075c0

File tree

7 files changed

+56
-86
lines changed

7 files changed

+56
-86
lines changed

src/resolvers/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ const userNotifications = require('./userNotifications').default;
1717
const billing = require('./billingNew').default;
1818
const EncodedJSON = require('./encodedJSON').default;
1919
const seed = require('./seed').default;
20-
const release = require('./release').default;
2120

2221
/**
2322
* @typedef ResolverObj
@@ -75,7 +74,6 @@ const resolvers = [
7574
userNotifications,
7675
plans,
7776
billing,
78-
release,
7977
];
8078

8179
if (isE2E) {

src/resolvers/project.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,26 @@ module.exports = {
265265
return event;
266266
},
267267

268+
/**
269+
* Returns project releases
270+
*
271+
* @param {ProjectDBScheme} project - result of parent resolver
272+
* @param {ContextFactories} context - Global GraphQL context with factories
273+
* @returns {Promise<Release[]>}
274+
*/
275+
async releases(project, _, { factories }) {
276+
if (!project._id) {
277+
throw new Error('projectId is required to fetch releases');
278+
}
279+
280+
try {
281+
return await factories.releasesFactory.findManyByProjectId(project._id.toString());
282+
} catch (error) {
283+
console.error('Error fetching releases:', error);
284+
throw new Error('Failed to get the releases');
285+
}
286+
},
287+
268288
/**
269289
* Find project events
270290
*

src/resolvers/release.ts

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/typeDefs/event.ts

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,21 @@ type SourceCodeLine {
1616
content: String
1717
}
1818
19+
"""
20+
Source map file details
21+
"""
22+
type SourceMapData {
23+
"""
24+
Source map filename
25+
"""
26+
mapFileName: String!
27+
28+
"""
29+
Original source filename
30+
"""
31+
originFileName: String!
32+
}
33+
1934
"""
2035
Release commit
2136
"""
@@ -42,18 +57,33 @@ type Commit {
4257
}
4358
4459
"""
45-
Release data of the corresponding event
60+
Release data
4661
"""
4762
type Release {
63+
"""
64+
Release ID
65+
"""
66+
id: ID! @renameFrom(name: "_id")
67+
4868
"""
4969
Release name
5070
"""
5171
releaseName: String! @renameFrom(name: "release")
5272
73+
"""
74+
Project ID associated with the release
75+
"""
76+
projectId: ID!
77+
5378
"""
5479
Release commits
5580
"""
5681
commits: [Commit!]!
82+
83+
"""
84+
Source maps associated with the release
85+
"""
86+
files: [SourceMapData!]!
5787
}
5888
5989
"""

src/typeDefs/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import workspaceMutations from './workspaceMutations';
1515
import chart from './chart';
1616
import plans from './plans';
1717
import seed from './seed';
18-
import release from './release';
1918
import isE2E from '../utils/isE2E';
2019

2120
const rootSchema = gql`
@@ -99,7 +98,6 @@ const typeDefinitions = [
9998
workspaceMutations,
10099
chart,
101100
plans,
102-
release,
103101
];
104102

105103
if (isE2E) {

src/typeDefs/project.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ type Project {
109109
skip: Int = 0
110110
): [Event!]
111111
112+
"""
113+
Project releases
114+
"""
115+
releases: [Release!]!
116+
112117
"""
113118
Returns recent events grouped by day
114119
"""

src/typeDefs/release.ts

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)