diff --git a/backend/src/api/most-recent-image/content-types/most-recent-image/schema.json b/backend/src/api/most-recent-image/content-types/most-recent-image/schema.json new file mode 100644 index 0000000..3d977ee --- /dev/null +++ b/backend/src/api/most-recent-image/content-types/most-recent-image/schema.json @@ -0,0 +1,31 @@ +{ + "kind": "collectionType", + "collectionName": "most_recent_images", + "info": { + "singularName": "most-recent-image", + "pluralName": "most-recent-images", + "displayName": "Most Recent Image" + }, + "options": { + "draftAndPublish": true + }, + "pluginOptions": {}, + "attributes": { + "mostRecentImage": { + "allowedTypes": [ + "images", + "files", + "videos", + "audios" + ], + "type": "media", + "multiple": false, + "required": true + }, + "satellite": { + "type": "relation", + "relation": "oneToOne", + "target": "api::satellite.satellite" + } + } +} diff --git a/backend/src/api/most-recent-image/controllers/most-recent-image.js b/backend/src/api/most-recent-image/controllers/most-recent-image.js new file mode 100644 index 0000000..8139ca5 --- /dev/null +++ b/backend/src/api/most-recent-image/controllers/most-recent-image.js @@ -0,0 +1,9 @@ +'use strict'; + +/** + * most-recent-image controller + */ + +const { createCoreController } = require('@strapi/strapi').factories; + +module.exports = createCoreController('api::most-recent-image.most-recent-image'); diff --git a/backend/src/api/most-recent-image/documentation/1.0.0/most-recent-image.json b/backend/src/api/most-recent-image/documentation/1.0.0/most-recent-image.json new file mode 100644 index 0000000..e68f7f9 --- /dev/null +++ b/backend/src/api/most-recent-image/documentation/1.0.0/most-recent-image.json @@ -0,0 +1,507 @@ +{ + "/most-recent-images": { + "get": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MostRecentImageListResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Most-recent-image" + ], + "parameters": [ + { + "name": "sort", + "in": "query", + "description": "Sort by attributes ascending (asc) or descending (desc)", + "deprecated": false, + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "pagination[withCount]", + "in": "query", + "description": "Return page/pageSize (default: true)", + "deprecated": false, + "required": false, + "schema": { + "type": "boolean" + } + }, + { + "name": "pagination[page]", + "in": "query", + "description": "Page number (default: 0)", + "deprecated": false, + "required": false, + "schema": { + "type": "integer" + } + }, + { + "name": "pagination[pageSize]", + "in": "query", + "description": "Page size (default: 25)", + "deprecated": false, + "required": false, + "schema": { + "type": "integer" + } + }, + { + "name": "pagination[start]", + "in": "query", + "description": "Offset value (default: 0)", + "deprecated": false, + "required": false, + "schema": { + "type": "integer" + } + }, + { + "name": "pagination[limit]", + "in": "query", + "description": "Number of entities to return (default: 25)", + "deprecated": false, + "required": false, + "schema": { + "type": "integer" + } + }, + { + "name": "fields", + "in": "query", + "description": "Fields to return (ex: title,author)", + "deprecated": false, + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "populate", + "in": "query", + "description": "Relations to return", + "deprecated": false, + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "filters", + "in": "query", + "description": "Filters to apply", + "deprecated": false, + "required": false, + "schema": { + "type": "object" + }, + "style": "deepObject" + }, + { + "name": "locale", + "in": "query", + "description": "Locale to apply", + "deprecated": false, + "required": false, + "schema": { + "type": "string" + } + } + ], + "operationId": "get/most-recent-images" + }, + "post": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MostRecentImageResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Most-recent-image" + ], + "parameters": [], + "operationId": "post/most-recent-images", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MostRecentImageRequest" + } + } + } + } + } + }, + "/most-recent-images/{id}": { + "get": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MostRecentImageResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Most-recent-image" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "", + "deprecated": false, + "required": true, + "schema": { + "type": "number" + } + } + ], + "operationId": "get/most-recent-images/{id}" + }, + "put": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MostRecentImageResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Most-recent-image" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "", + "deprecated": false, + "required": true, + "schema": { + "type": "number" + } + } + ], + "operationId": "put/most-recent-images/{id}", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MostRecentImageRequest" + } + } + } + } + }, + "delete": { + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "integer", + "format": "int64" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + }, + "tags": [ + "Most-recent-image" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "", + "deprecated": false, + "required": true, + "schema": { + "type": "number" + } + } + ], + "operationId": "delete/most-recent-images/{id}" + } + } +} diff --git a/backend/src/api/most-recent-image/routes/most-recent-image.js b/backend/src/api/most-recent-image/routes/most-recent-image.js new file mode 100644 index 0000000..8640e95 --- /dev/null +++ b/backend/src/api/most-recent-image/routes/most-recent-image.js @@ -0,0 +1,9 @@ +'use strict'; + +/** + * most-recent-image router + */ + +const { createCoreRouter } = require('@strapi/strapi').factories; + +module.exports = createCoreRouter('api::most-recent-image.most-recent-image'); diff --git a/backend/src/api/most-recent-image/services/most-recent-image.js b/backend/src/api/most-recent-image/services/most-recent-image.js new file mode 100644 index 0000000..c5725b3 --- /dev/null +++ b/backend/src/api/most-recent-image/services/most-recent-image.js @@ -0,0 +1,9 @@ +'use strict'; + +/** + * most-recent-image service + */ + +const { createCoreService } = require('@strapi/strapi').factories; + +module.exports = createCoreService('api::most-recent-image.most-recent-image'); diff --git a/backend/types/generated/contentTypes.d.ts b/backend/types/generated/contentTypes.d.ts index ad6269e..dcb3545 100644 --- a/backend/types/generated/contentTypes.d.ts +++ b/backend/types/generated/contentTypes.d.ts @@ -854,6 +854,42 @@ export interface ApiAuthorAuthor extends Schema.CollectionType { }; } +export interface ApiMostRecentImageMostRecentImage + extends Schema.CollectionType { + collectionName: 'most_recent_images'; + info: { + singularName: 'most-recent-image'; + pluralName: 'most-recent-images'; + displayName: 'Most Recent Image'; + }; + options: { + draftAndPublish: true; + }; + attributes: { + mostRecentImage: Attribute.Media & Attribute.Required; + satellite: Attribute.Relation< + 'api::most-recent-image.most-recent-image', + 'oneToOne', + 'api::satellite.satellite' + >; + createdAt: Attribute.DateTime; + updatedAt: Attribute.DateTime; + publishedAt: Attribute.DateTime; + createdBy: Attribute.Relation< + 'api::most-recent-image.most-recent-image', + 'oneToOne', + 'admin::user' + > & + Attribute.Private; + updatedBy: Attribute.Relation< + 'api::most-recent-image.most-recent-image', + 'oneToOne', + 'admin::user' + > & + Attribute.Private; + }; +} + export interface ApiPartnerPartner extends Schema.CollectionType { collectionName: 'partners'; info: { @@ -1059,6 +1095,7 @@ declare module '@strapi/types' { 'plugin::users-permissions.user': PluginUsersPermissionsUser; 'api::article.article': ApiArticleArticle; 'api::author.author': ApiAuthorAuthor; + 'api::most-recent-image.most-recent-image': ApiMostRecentImageMostRecentImage; 'api::partner.partner': ApiPartnerPartner; 'api::person.person': ApiPersonPerson; 'api::ph-d-project.ph-d-project': ApiPhDProjectPhDProject; diff --git a/frontend/src/__generated__/gql.ts b/frontend/src/__generated__/gql.ts index 41f5e67..f775088 100644 --- a/frontend/src/__generated__/gql.ts +++ b/frontend/src/__generated__/gql.ts @@ -19,6 +19,7 @@ const documents = { "\nquery People {\n people {\n data {\n id\n attributes {\n name\n workTitle\n employeeLink\n profilePicture {\n data {\n attributes {\n url\n }\n }\n }\n profilePictureURL\n role\n }\n }\n }\n }\n": types.PeopleDocument, "query ArticleWithSlug($articlesFilters: ArticleFiltersInput) {\n articles(filters: $articlesFilters) {\n data {\n attributes {\n author {\n data {\n attributes {\n name\n avatar {\n data {\n attributes {\n url\n }\n }\n }\n }\n }\n }\n body\n coverImage {\n data {\n attributes {\n url\n }\n }\n }\n datePublished\n subtitle\n title\n }\n }\n }\n }\n \n ": types.ArticleWithSlugDocument, "\nquery GET_ARTICLES {\n articles(sort: [\"datePublished:desc\"]) {\n data {\n id\n attributes {\n author {\n data {\n attributes {\n name\n avatar {\n data {\n attributes {\n url\n }\n }\n }\n }\n }\n }\n title\n datePublished\n body\n coverImage {\n data {\n attributes {\n url\n }\n }\n }\n createdAt\n publishedAt\n slug\n subtitle\n }\n }\n }\n}\n": types.Get_ArticlesDocument, + "\nquery MostRecentImages {\n mostRecentImages(sort: [\"publishedAt:desc\"]) {\n data {\n attributes {\n mostRecentImage {\n data {\n attributes {\n url\n }\n }\n }\n satellite {\n data {\n attributes {\n catalogNumberNORAD\n }\n }\n }\n createdAt\n updatedAt\n publishedAt\n }\n }\n }\n}\n\n": types.MostRecentImagesDocument, "\nquery Projects($projectFilters: ProjectFiltersInput) {\n projects(filters: $projectFilters) {\n data {\n attributes {\n title\n description\n article\n satellites {\n data {\n id\n attributes {\n catalogNumberNORAD\n projects {\n data {\n id\n }\n }\n createdAt\n updatedAt\n publishedAt\n }\n }\n }\n slug\n publishedAt\n coverImage {\n data {\n id\n attributes {\n url\n }\n }\n }\n }\n }\n }\n }": types.ProjectsDocument, "\n query GET_PROJECTS {\n projects(sort: [\"publishedAt:desc\"]) {\n data {\n id\n attributes {\n title\n article\n satellites {\n data {\n attributes {\n catalogNumberNORAD\n }\n }\n }\n slug\n coverImage {\n data {\n attributes {\n url\n }\n }\n }\n updatedAt\n publishedAt\n createdAt\n description\n }\n }\n }\n }": types.Get_ProjectsDocument, "query GET_SATELLITE_INFO($filters: SatelliteFiltersInput) {\n satellites(filters: $filters) {\n data {\n id\n attributes {\n celestrakURL\n catalogNumberNORAD\n content\n satelliteName\n }\n }\n }\n}\n ": types.Get_Satellite_InfoDocument, @@ -64,6 +65,10 @@ export function gql(source: "query ArticleWithSlug($articlesFilters: ArticleFilt * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ export function gql(source: "\nquery GET_ARTICLES {\n articles(sort: [\"datePublished:desc\"]) {\n data {\n id\n attributes {\n author {\n data {\n attributes {\n name\n avatar {\n data {\n attributes {\n url\n }\n }\n }\n }\n }\n }\n title\n datePublished\n body\n coverImage {\n data {\n attributes {\n url\n }\n }\n }\n createdAt\n publishedAt\n slug\n subtitle\n }\n }\n }\n}\n"): (typeof documents)["\nquery GET_ARTICLES {\n articles(sort: [\"datePublished:desc\"]) {\n data {\n id\n attributes {\n author {\n data {\n attributes {\n name\n avatar {\n data {\n attributes {\n url\n }\n }\n }\n }\n }\n }\n title\n datePublished\n body\n coverImage {\n data {\n attributes {\n url\n }\n }\n }\n createdAt\n publishedAt\n slug\n subtitle\n }\n }\n }\n}\n"]; +/** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function gql(source: "\nquery MostRecentImages {\n mostRecentImages(sort: [\"publishedAt:desc\"]) {\n data {\n attributes {\n mostRecentImage {\n data {\n attributes {\n url\n }\n }\n }\n satellite {\n data {\n attributes {\n catalogNumberNORAD\n }\n }\n }\n createdAt\n updatedAt\n publishedAt\n }\n }\n }\n}\n\n"): (typeof documents)["\nquery MostRecentImages {\n mostRecentImages(sort: [\"publishedAt:desc\"]) {\n data {\n attributes {\n mostRecentImage {\n data {\n attributes {\n url\n }\n }\n }\n satellite {\n data {\n attributes {\n catalogNumberNORAD\n }\n }\n }\n createdAt\n updatedAt\n publishedAt\n }\n }\n }\n}\n\n"]; /** * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ diff --git a/frontend/src/__generated__/graphql.ts b/frontend/src/__generated__/graphql.ts index 247300b..14fa3f1 100644 --- a/frontend/src/__generated__/graphql.ts +++ b/frontend/src/__generated__/graphql.ts @@ -354,7 +354,7 @@ export type FloatFilterInput = { startsWith?: InputMaybe; }; -export type GenericMorph = Article | Author | ContentReleasesRelease | ContentReleasesReleaseAction | I18NLocale | Partner | Person | PhDProject | Project | Satellite | UploadFile | UploadFolder | UsersPermissionsPermission | UsersPermissionsRole | UsersPermissionsUser; +export type GenericMorph = Article | Author | ContentReleasesRelease | ContentReleasesReleaseAction | I18NLocale | MostRecentImage | Partner | Person | PhDProject | Project | Satellite | UploadFile | UploadFolder | UsersPermissionsPermission | UsersPermissionsRole | UsersPermissionsUser; export type I18NLocale = { __typename?: 'I18NLocale'; @@ -467,6 +467,49 @@ export type JsonFilterInput = { startsWith?: InputMaybe; }; +export type MostRecentImage = { + __typename?: 'MostRecentImage'; + createdAt?: Maybe; + mostRecentImage: UploadFileEntityResponse; + publishedAt?: Maybe; + satellite?: Maybe; + updatedAt?: Maybe; +}; + +export type MostRecentImageEntity = { + __typename?: 'MostRecentImageEntity'; + attributes?: Maybe; + id?: Maybe; +}; + +export type MostRecentImageEntityResponse = { + __typename?: 'MostRecentImageEntityResponse'; + data?: Maybe; +}; + +export type MostRecentImageEntityResponseCollection = { + __typename?: 'MostRecentImageEntityResponseCollection'; + data: Array; + meta: ResponseCollectionMeta; +}; + +export type MostRecentImageFiltersInput = { + and?: InputMaybe>>; + createdAt?: InputMaybe; + id?: InputMaybe; + not?: InputMaybe; + or?: InputMaybe>>; + publishedAt?: InputMaybe; + satellite?: InputMaybe; + updatedAt?: InputMaybe; +}; + +export type MostRecentImageInput = { + mostRecentImage?: InputMaybe; + publishedAt?: InputMaybe; + satellite?: InputMaybe; +}; + export type Mutation = { __typename?: 'Mutation'; /** Change user password. Confirm with the current password. */ @@ -475,6 +518,7 @@ export type Mutation = { createAuthor?: Maybe; createContentReleasesRelease?: Maybe; createContentReleasesReleaseAction?: Maybe; + createMostRecentImage?: Maybe; createPartner?: Maybe; createPerson?: Maybe; createPhDProject?: Maybe; @@ -490,6 +534,7 @@ export type Mutation = { deleteAuthor?: Maybe; deleteContentReleasesRelease?: Maybe; deleteContentReleasesReleaseAction?: Maybe; + deleteMostRecentImage?: Maybe; deletePartner?: Maybe; deletePerson?: Maybe; deletePhDProject?: Maybe; @@ -517,6 +562,7 @@ export type Mutation = { updateContentReleasesRelease?: Maybe; updateContentReleasesReleaseAction?: Maybe; updateFileInfo: UploadFileEntityResponse; + updateMostRecentImage?: Maybe; updatePartner?: Maybe; updatePerson?: Maybe; updatePhDProject?: Maybe; @@ -559,6 +605,11 @@ export type MutationCreateContentReleasesReleaseActionArgs = { }; +export type MutationCreateMostRecentImageArgs = { + data: MostRecentImageInput; +}; + + export type MutationCreatePartnerArgs = { data: PartnerInput; }; @@ -624,6 +675,11 @@ export type MutationDeleteContentReleasesReleaseActionArgs = { }; +export type MutationDeleteMostRecentImageArgs = { + id: Scalars['ID']['input']; +}; + + export type MutationDeletePartnerArgs = { id: Scalars['ID']['input']; }; @@ -739,6 +795,12 @@ export type MutationUpdateFileInfoArgs = { }; +export type MutationUpdateMostRecentImageArgs = { + data: MostRecentImageInput; + id: Scalars['ID']['input']; +}; + + export type MutationUpdatePartnerArgs = { data: PartnerInput; id: Scalars['ID']['input']; @@ -1053,6 +1115,8 @@ export type Query = { i18NLocale?: Maybe; i18NLocales?: Maybe; me?: Maybe; + mostRecentImage?: Maybe; + mostRecentImages?: Maybe; partner?: Maybe; partners?: Maybe; people?: Maybe; @@ -1136,6 +1200,19 @@ export type QueryI18NLocalesArgs = { }; +export type QueryMostRecentImageArgs = { + id?: InputMaybe; +}; + + +export type QueryMostRecentImagesArgs = { + filters?: InputMaybe; + pagination?: InputMaybe; + publicationState?: InputMaybe; + sort?: InputMaybe>>; +}; + + export type QueryPartnerArgs = { id?: InputMaybe; }; @@ -1751,6 +1828,11 @@ export type Get_ArticlesQueryVariables = Exact<{ [key: string]: never; }>; export type Get_ArticlesQuery = { __typename?: 'Query', articles?: { __typename?: 'ArticleEntityResponseCollection', data: Array<{ __typename?: 'ArticleEntity', id?: string | null, attributes?: { __typename?: 'Article', title?: string | null, datePublished?: any | null, body?: any | null, createdAt?: any | null, publishedAt?: any | null, slug?: string | null, subtitle?: string | null, author?: { __typename?: 'AuthorEntityResponse', data?: { __typename?: 'AuthorEntity', attributes?: { __typename?: 'Author', name?: string | null, avatar?: { __typename?: 'UploadFileRelationResponseCollection', data: Array<{ __typename?: 'UploadFileEntity', attributes?: { __typename?: 'UploadFile', url: string } | null }> } | null } | null } | null } | null, coverImage?: { __typename?: 'UploadFileEntityResponse', data?: { __typename?: 'UploadFileEntity', attributes?: { __typename?: 'UploadFile', url: string } | null } | null } | null } | null }> } | null }; +export type MostRecentImagesQueryVariables = Exact<{ [key: string]: never; }>; + + +export type MostRecentImagesQuery = { __typename?: 'Query', mostRecentImages?: { __typename?: 'MostRecentImageEntityResponseCollection', data: Array<{ __typename?: 'MostRecentImageEntity', attributes?: { __typename?: 'MostRecentImage', createdAt?: any | null, updatedAt?: any | null, publishedAt?: any | null, mostRecentImage: { __typename?: 'UploadFileEntityResponse', data?: { __typename?: 'UploadFileEntity', attributes?: { __typename?: 'UploadFile', url: string } | null } | null }, satellite?: { __typename?: 'SatelliteEntityResponse', data?: { __typename?: 'SatelliteEntity', attributes?: { __typename?: 'Satellite', catalogNumberNORAD?: string | null } | null } | null } | null } | null }> } | null }; + export type ProjectsQueryVariables = Exact<{ projectFilters?: InputMaybe; }>; @@ -1789,6 +1871,7 @@ export const PhDProjectsDocument = {"kind":"Document","definitions":[{"kind":"Op export const PeopleDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"People"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"people"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"workTitle"}},{"kind":"Field","name":{"kind":"Name","value":"employeeLink"}},{"kind":"Field","name":{"kind":"Name","value":"profilePicture"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"profilePictureURL"}},{"kind":"Field","name":{"kind":"Name","value":"role"}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const ArticleWithSlugDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"ArticleWithSlug"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"articlesFilters"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"ArticleFiltersInput"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"articles"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filters"},"value":{"kind":"Variable","name":{"kind":"Name","value":"articlesFilters"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"author"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatar"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"body"}},{"kind":"Field","name":{"kind":"Name","value":"coverImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"datePublished"}},{"kind":"Field","name":{"kind":"Name","value":"subtitle"}},{"kind":"Field","name":{"kind":"Name","value":"title"}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const Get_ArticlesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GET_ARTICLES"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"articles"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"sort"},"value":{"kind":"ListValue","values":[{"kind":"StringValue","value":"datePublished:desc","block":false}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"author"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatar"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"datePublished"}},{"kind":"Field","name":{"kind":"Name","value":"body"}},{"kind":"Field","name":{"kind":"Name","value":"coverImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"publishedAt"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"subtitle"}}]}}]}}]}}]}}]} as unknown as DocumentNode; +export const MostRecentImagesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"MostRecentImages"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"mostRecentImages"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"sort"},"value":{"kind":"ListValue","values":[{"kind":"StringValue","value":"publishedAt:desc","block":false}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"mostRecentImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"satellite"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"catalogNumberNORAD"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"publishedAt"}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const ProjectsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"Projects"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"projectFilters"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"ProjectFiltersInput"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"projects"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filters"},"value":{"kind":"Variable","name":{"kind":"Name","value":"projectFilters"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"article"}},{"kind":"Field","name":{"kind":"Name","value":"satellites"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"catalogNumberNORAD"}},{"kind":"Field","name":{"kind":"Name","value":"projects"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"publishedAt"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"publishedAt"}},{"kind":"Field","name":{"kind":"Name","value":"coverImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const Get_ProjectsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GET_PROJECTS"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"projects"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"sort"},"value":{"kind":"ListValue","values":[{"kind":"StringValue","value":"publishedAt:desc","block":false}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"article"}},{"kind":"Field","name":{"kind":"Name","value":"satellites"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"catalogNumberNORAD"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"coverImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"publishedAt"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const Get_Satellite_InfoDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GET_SATELLITE_INFO"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"filters"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"SatelliteFiltersInput"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"satellites"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filters"},"value":{"kind":"Variable","name":{"kind":"Name","value":"filters"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"celestrakURL"}},{"kind":"Field","name":{"kind":"Name","value":"catalogNumberNORAD"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"satelliteName"}}]}}]}}]}}]}}]} as unknown as DocumentNode; diff --git a/frontend/src/app/page.tsx b/frontend/src/app/page.tsx index 0e6042d..42b6ec8 100644 --- a/frontend/src/app/page.tsx +++ b/frontend/src/app/page.tsx @@ -1,6 +1,10 @@ import { Button } from "@/components/ui/button"; import ColoredSection from "@/components/ui/coloredSection"; +import { gql } from "@/__generated__/gql"; +import { getClient } from "@/lib/ApolloClient"; +const HOST_URL = process.env.HOST_URL; + import Image from "next/image"; import Link from "next/link"; @@ -12,7 +16,50 @@ const MyCustomMap = dynamic(() => import("@/components/map/MyCustomMap"), { ssr: false, }); -export default function Home() { +const GET_MOST_RECENT_IMAGE = gql(` +query MostRecentImages { + mostRecentImages(sort: ["publishedAt:desc"]) { + data { + attributes { + mostRecentImage { + data { + attributes { + url + } + } + } + satellite { + data { + attributes { + catalogNumberNORAD + } + } + } + createdAt + updatedAt + publishedAt + } + } + } +} + +`); + +export default async function Home() { + const graphqlData = await getClient().query({ + query: GET_MOST_RECENT_IMAGE, + }); + + let mostRecentImageURL = + graphqlData.data.mostRecentImages?.data[0]?.attributes?.mostRecentImage + ?.data?.attributes?.url; + + if (HOST_URL && mostRecentImageURL != undefined) { + mostRecentImageURL = HOST_URL + mostRecentImageURL; + } else { + mostRecentImageURL = ""; + } + return (
@@ -80,8 +127,8 @@ export default function Home() {

Most recent picture