We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 548a461 + 152e2f6 commit b467873Copy full SHA for b467873
1 file changed
src/api/github-release/content-types/github-release/lifecycles.js
@@ -0,0 +1,18 @@
1
+'use strict';
2
+
3
+module.exports = {
4
+ async beforeCreate(event) {
5
+ const { data } = event.params;
6
+ if (data.isLatest === true) {
7
+ await strapi.db.query('api::github-release.github-release').updateMany({
8
+ where: {
9
+ isLatest: true,
10
+ type: data.type.toUpperCase(),
11
+ },
12
+ data: {
13
+ isLatest: false,
14
15
+ });
16
+ }
17
18
+};
0 commit comments