diff --git a/api.http b/api.http index a9e66eb..af64e3c 100644 --- a/api.http +++ b/api.http @@ -13,7 +13,7 @@ Accept: application/json #Authorization: Bearer {{token}} ### GET request with a header -GET {{domain}}/api/about?populate[header][fields][0]=header1&populate[header][fields][1]=description&populate[footer][fields][0]=*&populate[footer][populate][links][fields][0]=*&populate[footer][populate][contactUsEmail][fields][0]=*&populate[footer][populate][contactUsLocation][fields][0]=*&populate[footer][populate][contactUsPhoneNumber][fields][0]=*&populate[subscribeNow][fields][0]=*&populate[blogs][fields][0]=*&populate[blogs][populate][button][fields][0]=*&populate[blogs][populate][posts][fields][0]=name&populate[blogs][populate][posts][fields][1]=id&populate[blogs][populate][posts][fields][2]=header&populate[blogs][populate][posts][fields][3]=documentId&populate[blogs][populate][posts][populate][tags][fields][0]=*&populate[blogs][populate][posts][populate][teaserImage][fields][0]=name&populate[blogs][populate][posts][populate][teaserImage][fields][1]=mime&populate[blogs][populate][posts][populate][teaserImage][fields][2]=url&populate[feedbacks][fields][0]=*&populate[feedbacks][populate][feedbacks][fields][0]=*&populate[feedbacks][populate][feedbacks][populate][customerImage][fields][0]=name&populate[feedbacks][populate][feedbacks][populate][customerImage][fields][1]=mime&populate[feedbacks][populate][feedbacks][populate][customerImage][fields][2]=url&populate[ourServices][fields][0]=*&populate[ourServices][populate][services][fields][0]=*&populate[ourServices][populate][services][populate][image][fields][0]=name&populate[ourServices][populate][services][populate][image][fields][1]=mime&populate[ourServices][populate][services][populate][image][fields][2]=url&populate[aboutUs1][fields][0]=*&populate[aboutUs1][populate][image][fields][0]=name&populate[aboutUs1][populate][image][fields][1]=mime&populate[aboutUs1][populate][image][fields][2]=url&populate[contactUs][fields][0]=*&populate[prices][fields][0]=*&populate[prices][populate][prices][fields][0]=*&populate[prices][populate][prices][populate][icon][fields][0]=name&populate[prices][populate][prices][populate][icon][fields][1]=mime&populate[prices][populate][prices][populate][icon][fields][2]=url&populate[prices][populate][prices][populate][image][fields][0]=name&populate[prices][populate][prices][populate][image][fields][1]=mime&populate[prices][populate][prices][populate][image][fields][2]=url&populate[ourSpecialities][fields][0]=*&populate[ourSpecialities][populate][left1][fields][0]=*&populate[ourSpecialities][populate][left2][fields][0]=*&populate[ourSpecialities][populate][left3][fields][0]=*&populate[ourSpecialities][populate][left4][fields][0]=*&populate[ourSpecialities][populate][right1][fields][0]=*&populate[ourSpecialities][populate][right2][fields][0]=*&populate[ourSpecialities][populate][right3][fields][0]=*&populate[ourSpecialities][populate][right4][fields][0]=* +GET {{domain}}/api/about?api/services-page? Accept: application/json #Authorization: Bearer {{token}} diff --git a/yoga-app/src/api/strapi/query/services.json b/yoga-app/src/api/strapi/query/services.json new file mode 100644 index 0000000..13cba5f --- /dev/null +++ b/yoga-app/src/api/strapi/query/services.json @@ -0,0 +1,102 @@ +{ + "fields": ["*"], + "populate": { + "ourServices": { + "fields": ["*"], + "populate": { + "services": { + "fields": ["*"], + "populate": { + "image": { + "fields": ["name","mime","url"] + } + } + } + } + }, + "contactUs": { + "fields": ["*"] + }, + "ourSpecialities": { + "fields": ["*"] , + "populate": { + "left1": { + "fields": ["*"] + }, + "left2": { + "fields": ["*"] + }, + "left3": { + "fields": ["*"] + }, + "left4": { + "fields": ["*"] + }, + "right1": { + "fields": ["*"] + }, + "right2": { + "fields": ["*"] + }, + "right3": { + "fields": ["*"] + }, + "right4": { + "fields": ["*"] + } + } + }, + "feedbacks": { + "fields": ["*"], + "populate": { + "feedbacks": { + "fields": ["*"], + "populate": { + "customerImage": { + "fields": ["name","mime","url"] + } + } + } + } + }, + "blogs": { + "fields": ["*"], + "populate": { + "button": { + "fields": ["*"] + }, + "posts": { + "fields": ["name", "id", "header","documentId" ], + "populate": { + "tags": { + "fields": ["*" ] + }, + "teaserImage": { + "fields": ["name","mime","url"] + } + } + } + } + }, + "subscribe": { + "fields": ["*"] + }, + "footer": { + "fields": ["*"], + "populate": { + "links": { + "fields": ["*"] + }, + "contactUsEmail": { + "fields": ["*"] + }, + "contactUsLocation": { + "fields": ["*"] + }, + "contactUsPhoneNumber": { + "fields": ["*"] + } + } + } + } +} diff --git a/yoga-app/src/api/strapi/query/services.json.bak b/yoga-app/src/api/strapi/query/services.json.bak new file mode 100644 index 0000000..89bd8c5 --- /dev/null +++ b/yoga-app/src/api/strapi/query/services.json.bak @@ -0,0 +1,104 @@ +{ + "fields": ["*"], + "populate": { + + "ourServices": { + "fields": ["*"], + "populate": { + "services": { + "fields": ["*"], + "populate": { + "image": { + "fields": ["name","mime","url"] + } + } + } + } + }, + "contactUs": { + "fields": ["*"] + }, + "ourSpecialities": { + "fields": ["*"] , + "populate": { + "left1": { + "fields": ["*"] + }, + "left2": { + "fields": ["*"] + }, + "left3": { + "fields": ["*"] + }, + "left4": { + "fields": ["*"] + }, + "right1": { + "fields": ["*"] + }, + "right2": { + "fields": ["*"] + }, + "right3": { + "fields": ["*"] + }, + "right4": { + "fields": ["*"] + } + } + }, + "feedbacks": { + "fields": ["*"], + "populate": { + "feedbacks": { + "fields": ["*"], + "populate": { + "customerImage": { + "fields": ["name","mime","url"] + } + } + } + } + }, + "blogs": { + "fields": ["*"], + "populate": { + "button": { + "fields": ["*"] + }, + "posts": { + "fields": ["name", "id", "header","documentId" ], + "populate": { + "tags": { + "fields": ["*" ] + }, + "teaserImage": { + "fields": ["name","mime","url"] + } + } + } + } + }, + + "subscribeNow": { + "fields": ["*"] + }, + "footer": { + "fields": ["*"], + "populate": { + "links": { + "fields": ["*"] + }, + "contactUsEmail": { + "fields": ["*"] + }, + "contactUsLocation": { + "fields": ["*"] + }, + "contactUsPhoneNumber": { + "fields": ["*"] + } + } + } + } +} diff --git a/yoga-app/src/api/strapi/strapi-api.ts b/yoga-app/src/api/strapi/strapi-api.ts index 489795c..8ac59e8 100644 --- a/yoga-app/src/api/strapi/strapi-api.ts +++ b/yoga-app/src/api/strapi/strapi-api.ts @@ -3,8 +3,10 @@ import strapiClient from "@/api/strapi/strapi-client"; import qs from "qs"; import aboutQuery from "@/api/strapi/query/about.json"; import homeQuery from "@/api/strapi/query/home.json"; +import servicesQuery from "@/api/strapi/query/services.json"; import {YogaBlogPost_Plain} from "@/types/generated-strapi-interfaces/api/yoga-blog-post"; import {Home_Plain} from "@/types/generated-strapi-interfaces/api/home"; +import {ServicesPage_Plain} from "@/types/generated-strapi-interfaces/api/services-page"; class StrapiApi{ @@ -28,7 +30,10 @@ class StrapiApi{ public getHomePage(): Promise{ return this.getJson("/api/home?",homeQuery); + } + public getServicesPage(): Promise{ + return this.getJson("/api/services-page?",servicesQuery); } public getBlog(blogId: string): Promise{ diff --git a/yoga-app/src/app/services/page.tsx b/yoga-app/src/app/services/page.tsx index 7cd76ce..1f8fb6e 100644 --- a/yoga-app/src/app/services/page.tsx +++ b/yoga-app/src/app/services/page.tsx @@ -9,19 +9,31 @@ import FeedbackComponent from "@/components/feedbackComponent"; import BlogPostsComponent from "@/components/blog.posts.component"; import FooterComponent from "@/components/footer.component"; import SubscribeComponent from "@/components/subscribe.component"; +import strapiApi from "@/api/strapi/strapi-api"; +import SubHeaderComponent from "@/components/subHeader.component"; -export default function About() { +export default async function Services() { + const { + header, + description, + ourServices, + contactUs, + ourSpecialities, + feedbacks, + blogs, + footer, + subscribe + } = await strapiApi.getServicesPage(); return ( <> - - - - - - - - - + {header && description && } + { ourServices && } + { contactUs && } + { ourSpecialities && } + { feedbacks && } + { blogs && } + { subscribe && } + { footer && } diff --git a/yoga-app/src/types/generated-strapi-interfaces/api/services-page.ts b/yoga-app/src/types/generated-strapi-interfaces/api/services-page.ts new file mode 100644 index 0000000..e2ac6a0 --- /dev/null +++ b/yoga-app/src/types/generated-strapi-interfaces/api/services-page.ts @@ -0,0 +1,74 @@ +// Interface automatically generated by schemas-to-ts + +import { YogaOurServicesComponent } from './yoga-our-services-component'; +import { YogaContactUs } from './yoga-contact-us'; +import { YogaSpecialitiesComponent } from './yoga-specialities-component'; +import { YogaCustomerFeedbackComponent } from './yoga-customer-feedback-component'; +import { YogaBlogPostsComponent } from './yoga-blog-posts-component'; +import { YogaSubscribeNowComponent } from './yoga-subscribe-now-component'; +import { YogaFooter } from './yoga-footer'; +import { YogaOurServicesComponent_Plain } from './yoga-our-services-component'; +import { YogaContactUs_Plain } from './yoga-contact-us'; +import { YogaSpecialitiesComponent_Plain } from './yoga-specialities-component'; +import { YogaCustomerFeedbackComponent_Plain } from './yoga-customer-feedback-component'; +import { YogaBlogPostsComponent_Plain } from './yoga-blog-posts-component'; +import { YogaSubscribeNowComponent_Plain } from './yoga-subscribe-now-component'; +import { YogaFooter_Plain } from './yoga-footer'; +import { AdminPanelRelationPropertyModification } from '../common/AdminPanelRelationPropertyModification'; + +export interface ServicesPage { + id: number; + attributes: { + createdAt: Date; updatedAt: Date; publishedAt?: Date; header?: string; + description?: string; + ourServices?: { data: YogaOurServicesComponent }; + contactUs?: { data: YogaContactUs }; + ourSpecialities?: { data: YogaSpecialitiesComponent }; + feedbacks?: { data: YogaCustomerFeedbackComponent }; + blogs?: { data: YogaBlogPostsComponent }; + subscribe?: { data: YogaSubscribeNowComponent }; + footer?: { data: YogaFooter }; + title?: string; + }; +} +export interface ServicesPage_Plain { + id: number; + createdAt: Date; updatedAt: Date; publishedAt?: Date; header?: string; + description?: string; + ourServices?: YogaOurServicesComponent_Plain; + contactUs?: YogaContactUs_Plain; + ourSpecialities?: YogaSpecialitiesComponent_Plain; + feedbacks?: YogaCustomerFeedbackComponent_Plain; + blogs?: YogaBlogPostsComponent_Plain; + subscribe?: YogaSubscribeNowComponent_Plain; + footer?: YogaFooter_Plain; + title?: string; +} + +export interface ServicesPage_NoRelations { + id: number; + createdAt: Date; updatedAt: Date; publishedAt?: Date; header?: string; + description?: string; + ourServices?: number; + contactUs?: number; + ourSpecialities?: number; + feedbacks?: number; + blogs?: number; + subscribe?: number; + footer?: number; + title?: string; +} + +export interface ServicesPage_AdminPanelLifeCycle { + id: number; + createdAt: Date; updatedAt: Date; publishedAt?: Date; header?: string; + description?: string; + ourServices?: AdminPanelRelationPropertyModification; + contactUs?: AdminPanelRelationPropertyModification; + ourSpecialities?: AdminPanelRelationPropertyModification; + feedbacks?: AdminPanelRelationPropertyModification; + blogs?: AdminPanelRelationPropertyModification; + subscribe?: AdminPanelRelationPropertyModification; + footer?: AdminPanelRelationPropertyModification; + title?: string; +} diff --git a/yoga-cms/generated-strapi-interfaces/api/services-page.ts b/yoga-cms/generated-strapi-interfaces/api/services-page.ts new file mode 100644 index 0000000..e2ac6a0 --- /dev/null +++ b/yoga-cms/generated-strapi-interfaces/api/services-page.ts @@ -0,0 +1,74 @@ +// Interface automatically generated by schemas-to-ts + +import { YogaOurServicesComponent } from './yoga-our-services-component'; +import { YogaContactUs } from './yoga-contact-us'; +import { YogaSpecialitiesComponent } from './yoga-specialities-component'; +import { YogaCustomerFeedbackComponent } from './yoga-customer-feedback-component'; +import { YogaBlogPostsComponent } from './yoga-blog-posts-component'; +import { YogaSubscribeNowComponent } from './yoga-subscribe-now-component'; +import { YogaFooter } from './yoga-footer'; +import { YogaOurServicesComponent_Plain } from './yoga-our-services-component'; +import { YogaContactUs_Plain } from './yoga-contact-us'; +import { YogaSpecialitiesComponent_Plain } from './yoga-specialities-component'; +import { YogaCustomerFeedbackComponent_Plain } from './yoga-customer-feedback-component'; +import { YogaBlogPostsComponent_Plain } from './yoga-blog-posts-component'; +import { YogaSubscribeNowComponent_Plain } from './yoga-subscribe-now-component'; +import { YogaFooter_Plain } from './yoga-footer'; +import { AdminPanelRelationPropertyModification } from '../common/AdminPanelRelationPropertyModification'; + +export interface ServicesPage { + id: number; + attributes: { + createdAt: Date; updatedAt: Date; publishedAt?: Date; header?: string; + description?: string; + ourServices?: { data: YogaOurServicesComponent }; + contactUs?: { data: YogaContactUs }; + ourSpecialities?: { data: YogaSpecialitiesComponent }; + feedbacks?: { data: YogaCustomerFeedbackComponent }; + blogs?: { data: YogaBlogPostsComponent }; + subscribe?: { data: YogaSubscribeNowComponent }; + footer?: { data: YogaFooter }; + title?: string; + }; +} +export interface ServicesPage_Plain { + id: number; + createdAt: Date; updatedAt: Date; publishedAt?: Date; header?: string; + description?: string; + ourServices?: YogaOurServicesComponent_Plain; + contactUs?: YogaContactUs_Plain; + ourSpecialities?: YogaSpecialitiesComponent_Plain; + feedbacks?: YogaCustomerFeedbackComponent_Plain; + blogs?: YogaBlogPostsComponent_Plain; + subscribe?: YogaSubscribeNowComponent_Plain; + footer?: YogaFooter_Plain; + title?: string; +} + +export interface ServicesPage_NoRelations { + id: number; + createdAt: Date; updatedAt: Date; publishedAt?: Date; header?: string; + description?: string; + ourServices?: number; + contactUs?: number; + ourSpecialities?: number; + feedbacks?: number; + blogs?: number; + subscribe?: number; + footer?: number; + title?: string; +} + +export interface ServicesPage_AdminPanelLifeCycle { + id: number; + createdAt: Date; updatedAt: Date; publishedAt?: Date; header?: string; + description?: string; + ourServices?: AdminPanelRelationPropertyModification; + contactUs?: AdminPanelRelationPropertyModification; + ourSpecialities?: AdminPanelRelationPropertyModification; + feedbacks?: AdminPanelRelationPropertyModification; + blogs?: AdminPanelRelationPropertyModification; + subscribe?: AdminPanelRelationPropertyModification; + footer?: AdminPanelRelationPropertyModification; + title?: string; +} diff --git a/yoga-cms/src/api/services-page/content-types/services-page/schema.json b/yoga-cms/src/api/services-page/content-types/services-page/schema.json new file mode 100644 index 0000000..5f54b5a --- /dev/null +++ b/yoga-cms/src/api/services-page/content-types/services-page/schema.json @@ -0,0 +1,60 @@ +{ + "kind": "singleType", + "collectionName": "services_pages", + "info": { + "singularName": "services-page", + "pluralName": "services-pages", + "displayName": "Services", + "description": "" + }, + "options": { + "draftAndPublish": true + }, + "pluginOptions": {}, + "attributes": { + "header": { + "type": "string" + }, + "description": { + "type": "text" + }, + "ourServices": { + "type": "relation", + "relation": "oneToOne", + "target": "api::yoga-our-services-component.yoga-our-services-component" + }, + "contactUs": { + "type": "relation", + "relation": "oneToOne", + "target": "api::yoga-contact-us.yoga-contact-us" + }, + "ourSpecialities": { + "type": "relation", + "relation": "oneToOne", + "target": "api::yoga-specialities-component.yoga-specialities-component" + }, + "feedbacks": { + "type": "relation", + "relation": "oneToOne", + "target": "api::yoga-customer-feedback-component.yoga-customer-feedback-component" + }, + "blogs": { + "type": "relation", + "relation": "oneToOne", + "target": "api::yoga-blog-posts-component.yoga-blog-posts-component" + }, + "subscribe": { + "type": "relation", + "relation": "oneToOne", + "target": "api::yoga-subscribe-now-component.yoga-subscribe-now-component" + }, + "footer": { + "type": "relation", + "relation": "oneToOne", + "target": "api::yoga-footer.yoga-footer" + }, + "title": { + "type": "string" + } + } +} diff --git a/yoga-cms/src/api/services-page/controllers/services-page.ts b/yoga-cms/src/api/services-page/controllers/services-page.ts new file mode 100644 index 0000000..1719acc --- /dev/null +++ b/yoga-cms/src/api/services-page/controllers/services-page.ts @@ -0,0 +1,7 @@ +/** + * services-page controller + */ + +import { factories } from '@strapi/strapi' + +export default factories.createCoreController('api::services-page.services-page'); diff --git a/yoga-cms/src/api/services-page/routes/services-page.ts b/yoga-cms/src/api/services-page/routes/services-page.ts new file mode 100644 index 0000000..58e48d0 --- /dev/null +++ b/yoga-cms/src/api/services-page/routes/services-page.ts @@ -0,0 +1,7 @@ +/** + * services-page router + */ + +import { factories } from '@strapi/strapi'; + +export default factories.createCoreRouter('api::services-page.services-page'); diff --git a/yoga-cms/src/api/services-page/services/services-page.ts b/yoga-cms/src/api/services-page/services/services-page.ts new file mode 100644 index 0000000..89ff705 --- /dev/null +++ b/yoga-cms/src/api/services-page/services/services-page.ts @@ -0,0 +1,7 @@ +/** + * services-page service + */ + +import { factories } from '@strapi/strapi'; + +export default factories.createCoreService('api::services-page.services-page'); diff --git a/yoga-cms/types/generated/contentTypes.d.ts b/yoga-cms/types/generated/contentTypes.d.ts index 3b5a2ad..2aefb1f 100644 --- a/yoga-cms/types/generated/contentTypes.d.ts +++ b/yoga-cms/types/generated/contentTypes.d.ts @@ -700,6 +700,65 @@ export interface ApiPersonPerson extends Struct.SingleTypeSchema { }; } +export interface ApiServicesPageServicesPage extends Struct.SingleTypeSchema { + collectionName: 'services_pages'; + info: { + description: ''; + displayName: 'Services'; + pluralName: 'services-pages'; + singularName: 'services-page'; + }; + options: { + draftAndPublish: true; + }; + attributes: { + blogs: Schema.Attribute.Relation< + 'oneToOne', + 'api::yoga-blog-posts-component.yoga-blog-posts-component' + >; + contactUs: Schema.Attribute.Relation< + 'oneToOne', + 'api::yoga-contact-us.yoga-contact-us' + >; + createdAt: Schema.Attribute.DateTime; + createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & + Schema.Attribute.Private; + description: Schema.Attribute.Text; + feedbacks: Schema.Attribute.Relation< + 'oneToOne', + 'api::yoga-customer-feedback-component.yoga-customer-feedback-component' + >; + footer: Schema.Attribute.Relation< + 'oneToOne', + 'api::yoga-footer.yoga-footer' + >; + header: Schema.Attribute.String; + locale: Schema.Attribute.String & Schema.Attribute.Private; + localizations: Schema.Attribute.Relation< + 'oneToMany', + 'api::services-page.services-page' + > & + Schema.Attribute.Private; + ourServices: Schema.Attribute.Relation< + 'oneToOne', + 'api::yoga-our-services-component.yoga-our-services-component' + >; + ourSpecialities: Schema.Attribute.Relation< + 'oneToOne', + 'api::yoga-specialities-component.yoga-specialities-component' + >; + publishedAt: Schema.Attribute.DateTime; + subscribe: Schema.Attribute.Relation< + 'oneToOne', + 'api::yoga-subscribe-now-component.yoga-subscribe-now-component' + >; + title: Schema.Attribute.String; + updatedAt: Schema.Attribute.DateTime; + updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & + Schema.Attribute.Private; + }; +} + export interface ApiYogaAboutUsComponentYogaAboutUsComponent extends Struct.CollectionTypeSchema { collectionName: 'yoga_about_us_components'; @@ -2193,6 +2252,7 @@ declare module '@strapi/strapi' { 'api::home.home': ApiHomeHome; 'api::page.page': ApiPagePage; 'api::person.person': ApiPersonPerson; + 'api::services-page.services-page': ApiServicesPageServicesPage; 'api::yoga-about-us-component.yoga-about-us-component': ApiYogaAboutUsComponentYogaAboutUsComponent; 'api::yoga-about-us-with-boxes-component.yoga-about-us-with-boxes-component': ApiYogaAboutUsWithBoxesComponentYogaAboutUsWithBoxesComponent; 'api::yoga-achivement.yoga-achivement': ApiYogaAchivementYogaAchivement;