File tree 1 file changed +11
-5
lines changed
1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change 1
1
const { Op } = require ( 'sequelize' ) ;
2
2
const { getAtVersions } = require ( '../models/services/AtService' ) ;
3
+ const { AT_VERSIONS_SUPPORTED_BY_COLLECTION_JOBS } = require ( './constants' ) ;
3
4
4
5
const getAtVersionWithRequirements = async (
5
6
atId ,
@@ -33,11 +34,16 @@ const getAtVersionWithRequirements = async (
33
34
transaction
34
35
} ) ;
35
36
36
- const latestSupportedAtVersion = matchingAtVersions . find ( async atv => {
37
- // supportedByAutomation is a computed graphql field,
38
- // so we need to compute directly here
39
- return atv . supportedByAutomation ;
40
- } ) ;
37
+ const supportedVersions =
38
+ AT_VERSIONS_SUPPORTED_BY_COLLECTION_JOBS [
39
+ matchingAtVersions [ 0 ] ?. at ?. name
40
+ ] || [ ] ;
41
+
42
+ const latestSupportedAtVersion = matchingAtVersions . find (
43
+ atv =>
44
+ supportedVersions . includes ( atv . name ) &&
45
+ new Date ( atv . releasedAt ) >= new Date ( minimumAtVersion . releasedAt )
46
+ ) ;
41
47
42
48
if ( ! latestSupportedAtVersion ) {
43
49
throw new Error (
You can’t perform that action at this time.
0 commit comments