Skip to content

Commit

Permalink
fix(backend): 🐛 change recentImage to single type and rename to f… (#…
Browse files Browse the repository at this point in the history
…270)

* fix(backend): 🐛 change recentImage to single type and rename to featured image

* feat(backend): 🐛 fix duplicate lines in graphql.ts

* fix(backend): 🐛 fix contentTypes and graphql

* fix(frontend): 🐛 dont show "taken by" when no image is fetched

* fix(frontend): 🐛 replace image with ouiimage when featured image does not fetch anything
  • Loading branch information
Mats authored and GitHub committed Apr 15, 2024
1 parent 56f3375 commit 1e123b8
Show file tree
Hide file tree
Showing 15 changed files with 220 additions and 279 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"kind": "singleType",
"collectionName": "featured_images",
"info": {
"singularName": "featured-image",
"pluralName": "featured-images",
"displayName": "featuredImage"
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {},
"attributes": {
"featuredImage": {
"allowedTypes": [
"images",
"files",
"videos",
"audios"
],
"type": "media",
"multiple": false,
"required": true
},
"satellite": {
"type": "relation",
"relation": "oneToOne",
"target": "api::satellite.satellite"
}
}
}
9 changes: 9 additions & 0 deletions backend/src/api/featured-image/controllers/featured-image.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';

/**
* featured-image controller
*/

const { createCoreController } = require('@strapi/strapi').factories;

module.exports = createCoreController('api::featured-image.featured-image');
9 changes: 9 additions & 0 deletions backend/src/api/featured-image/routes/featured-image.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';

/**
* featured-image router
*/

const { createCoreRouter } = require('@strapi/strapi').factories;

module.exports = createCoreRouter('api::featured-image.featured-image');
9 changes: 9 additions & 0 deletions backend/src/api/featured-image/services/featured-image.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';

/**
* featured-image service
*/

const { createCoreService } = require('@strapi/strapi').factories;

module.exports = createCoreService('api::featured-image.featured-image');

This file was deleted.

This file was deleted.

9 changes: 0 additions & 9 deletions backend/src/api/most-recent-image/routes/most-recent-image.js

This file was deleted.

This file was deleted.

6 changes: 0 additions & 6 deletions backend/src/api/satellite/content-types/satellite/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,6 @@
"target": "api::project.project",
"mappedBy": "satellites"
},
"most_recent_images": {
"type": "relation",
"relation": "oneToMany",
"target": "api::most-recent-image.most-recent-image",
"mappedBy": "satellite"
},
"missionStatus": {
"type": "string"
},
Expand Down
70 changes: 32 additions & 38 deletions backend/types/generated/contentTypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -866,62 +866,61 @@ export interface ApiAuthorAuthor extends Schema.CollectionType {
};
}

export interface ApiHeroHero extends Schema.SingleType {
collectionName: 'heroes';
export interface ApiFeaturedImageFeaturedImage extends Schema.SingleType {
collectionName: 'featured_images';
info: {
singularName: 'hero';
pluralName: 'heroes';
displayName: 'Hero';
description: '';
singularName: 'featured-image';
pluralName: 'featured-images';
displayName: 'featuredImage';
};
options: {
draftAndPublish: true;
};
attributes: {
image: Attribute.Media & Attribute.Required;
text: Attribute.Text;
featuredImage: Attribute.Media & Attribute.Required;
satellite: Attribute.Relation<
'api::featured-image.featured-image',
'oneToOne',
'api::satellite.satellite'
>;
createdAt: Attribute.DateTime;
updatedAt: Attribute.DateTime;
publishedAt: Attribute.DateTime;
createdBy: Attribute.Relation<'api::hero.hero', 'oneToOne', 'admin::user'> &
createdBy: Attribute.Relation<
'api::featured-image.featured-image',
'oneToOne',
'admin::user'
> &
Attribute.Private;
updatedBy: Attribute.Relation<'api::hero.hero', 'oneToOne', 'admin::user'> &
updatedBy: Attribute.Relation<
'api::featured-image.featured-image',
'oneToOne',
'admin::user'
> &
Attribute.Private;
};
}

export interface ApiMostRecentImageMostRecentImage
extends Schema.CollectionType {
collectionName: 'most_recent_images';
export interface ApiHeroHero extends Schema.SingleType {
collectionName: 'heroes';
info: {
singularName: 'most-recent-image';
pluralName: 'most-recent-images';
displayName: 'Most Recent Image';
singularName: 'hero';
pluralName: 'heroes';
displayName: 'Hero';
description: '';
};
options: {
draftAndPublish: true;
};
attributes: {
mostRecentImage: Attribute.Media & Attribute.Required;
satellite: Attribute.Relation<
'api::most-recent-image.most-recent-image',
'manyToOne',
'api::satellite.satellite'
>;
image: Attribute.Media & Attribute.Required;
text: Attribute.Text;
createdAt: Attribute.DateTime;
updatedAt: Attribute.DateTime;
publishedAt: Attribute.DateTime;
createdBy: Attribute.Relation<
'api::most-recent-image.most-recent-image',
'oneToOne',
'admin::user'
> &
createdBy: Attribute.Relation<'api::hero.hero', 'oneToOne', 'admin::user'> &
Attribute.Private;
updatedBy: Attribute.Relation<
'api::most-recent-image.most-recent-image',
'oneToOne',
'admin::user'
> &
updatedBy: Attribute.Relation<'api::hero.hero', 'oneToOne', 'admin::user'> &
Attribute.Private;
};
}
Expand Down Expand Up @@ -987,11 +986,6 @@ export interface ApiSatelliteSatellite extends Schema.CollectionType {
'manyToMany',
'api::project.project'
>;
most_recent_images: Attribute.Relation<
'api::satellite.satellite',
'oneToMany',
'api::most-recent-image.most-recent-image'
>;
missionStatus: Attribute.String;
slug: Attribute.UID<'api::satellite.satellite', 'name'> &
Attribute.Required;
Expand Down Expand Up @@ -1033,8 +1027,8 @@ declare module '@strapi/types' {
'plugin::users-permissions.user': PluginUsersPermissionsUser;
'api::article.article': ApiArticleArticle;
'api::author.author': ApiAuthorAuthor;
'api::featured-image.featured-image': ApiFeaturedImageFeaturedImage;
'api::hero.hero': ApiHeroHero;
'api::most-recent-image.most-recent-image': ApiMostRecentImageMostRecentImage;
'api::project.project': ApiProjectProject;
'api::satellite.satellite': ApiSatelliteSatellite;
}
Expand Down
8 changes: 2 additions & 6 deletions frontend/src/__generated__/gql.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1e123b8

Please sign in to comment.