add prices page

This commit is contained in:
Schneider Roland 2025-01-28 23:09:42 +01:00
parent ceac176558
commit 93af3607e9
12 changed files with 333 additions and 18 deletions

View File

@ -13,7 +13,7 @@ Accept: application/json
#Authorization: Bearer {{token}} #Authorization: Bearer {{token}}
### GET request with a header ### GET request with a header
GET {{domain}}/api/about?api/services-page? GET {{domain}}/api/prices-page?fields[0]=*&populate[price][fields][0]=*&populate[price][populate][prices][fields][0]=*&populate[price][populate][prices][populate][icon][fields][0]=name&populate[price][populate][prices][populate][icon][fields][1]=mime&populate[price][populate][prices][populate][icon][fields][2]=url&populate[price][populate][prices][populate][image][fields][0]=name&populate[price][populate][prices][populate][image][fields][1]=mime&populate[price][populate][prices][populate][image][fields][2]=url&populate[discount][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[subscribeNow][fields][0]=*&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]=*
Accept: application/json Accept: application/json
#Authorization: Bearer {{token}} #Authorization: Bearer {{token}}

View File

@ -0,0 +1,63 @@
{
"fields": ["*"],
"populate": {
"price": {
"fields": ["*"],
"populate": {
"prices": {
"fields": ["*"],
"populate": {
"icon": {
"fields": ["name","mime","url"]
},
"image": {
"fields": ["name","mime","url"]
}
}
}
}
},
"discount": {
"fields": ["*"]
},
"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": ["*"]
}
}
}
}
}

View File

@ -4,9 +4,11 @@ import qs from "qs";
import aboutQuery from "@/api/strapi/query/about.json"; import aboutQuery from "@/api/strapi/query/about.json";
import homeQuery from "@/api/strapi/query/home.json"; import homeQuery from "@/api/strapi/query/home.json";
import servicesQuery from "@/api/strapi/query/services.json"; import servicesQuery from "@/api/strapi/query/services.json";
import pricesQuery from "@/api/strapi/query/prices.json";
import {YogaBlogPost_Plain} from "@/types/generated-strapi-interfaces/api/yoga-blog-post"; import {YogaBlogPost_Plain} from "@/types/generated-strapi-interfaces/api/yoga-blog-post";
import {Home_Plain} from "@/types/generated-strapi-interfaces/api/home"; import {Home_Plain} from "@/types/generated-strapi-interfaces/api/home";
import {ServicesPage_Plain} from "@/types/generated-strapi-interfaces/api/services-page"; import {ServicesPage_Plain} from "@/types/generated-strapi-interfaces/api/services-page";
import {PricesPage_Plain} from "@/types/generated-strapi-interfaces/api/prices-page";
class StrapiApi{ class StrapiApi{
@ -36,6 +38,11 @@ class StrapiApi{
return this.getJson("/api/services-page?",servicesQuery); return this.getJson("/api/services-page?",servicesQuery);
} }
public getPricesPage(): Promise<PricesPage_Plain>{
return this.getJson("/api/prices-page?",pricesQuery);
}
public getBlog(blogId: string): Promise<YogaBlogPost_Plain>{ public getBlog(blogId: string): Promise<YogaBlogPost_Plain>{
return this.getJson("/api/yoga-blog-posts/"+blogId,undefined); return this.getJson("/api/yoga-blog-posts/"+blogId,undefined);

View File

@ -1,28 +1,39 @@
import React from "react"; import React from "react";
import AosComponent from "@/components/aos.component"; import AosComponent from "@/components/aos.component";
import OurServicesComponent from "@/components/our.services.component";
import AboutUsComponent from "@/components/about.us.component";
import OurSpecialitiesComponent from "@/components/our.specialities.component";
import ContactUsComponent from "@/components/contact.us.component";
import PricingComponent from "@/components/pricing.component"; import PricingComponent from "@/components/pricing.component";
import FeedbackComponent from "@/components/feedbackComponent";
import BlogPostsComponent from "@/components/blog.posts.component"; import BlogPostsComponent from "@/components/blog.posts.component";
import FooterComponent from "@/components/footer.component";
import SubscribeComponent from "@/components/subscribe.component"; import SubscribeComponent from "@/components/subscribe.component";
import SubHeaderComponent from "@/components/subHeader.component";
import YogaDiscountComponent from "@/components/yogaDiscountComponent";
import {PricesPage_Plain} from "@/types/generated-strapi-interfaces/api/prices-page";
import FooterComponent from "@/components/footer.component";
import strapiApi from "@/api/strapi/strapi-api";
import BootstrapComponent from "@/components/bootstrap.component";
export default function About() { export interface Props{
config: PricesPage_Plain
}
export default async function PricesPage( ) {
const {
header,
description,
price,
discount,
blogs,
subscribe,
footer
} = await strapiApi.getPricesPage();
return ( return (
<> <>
<OurServicesComponent /> <SubHeaderComponent header1={header} description={description}/>
<AboutUsComponent /> { price && <PricingComponent config={price}/> }
<OurSpecialitiesComponent /> { discount && <YogaDiscountComponent config={discount} /> }
<ContactUsComponent /> { blogs && <BlogPostsComponent config={blogs} /> }
<PricingComponent /> { subscribe && <SubscribeComponent config={subscribe} /> }
<FeedbackComponent /> { footer && <FooterComponent config={footer} /> }
<BlogPostsComponent />
<SubscribeComponent />
<FooterComponent />
<AosComponent /> <AosComponent />
<BootstrapComponent />
</> </>
); );

View File

@ -11,7 +11,8 @@ type Props = {
const pathToBreadCrumbs = (path: string) => { const pathToBreadCrumbs = (path: string) => {
const mapping: Record<string, string> = { const mapping: Record<string, string> = {
'/' : 'Kezdőlap', '/' : 'Kezdőlap',
'about' : 'Rólam' 'about' : 'Rólam',
'services' : 'Szolgáltatásaim',
} }
if ( mapping.hasOwnProperty(path)){ if ( mapping.hasOwnProperty(path)){
return mapping[path]; return mapping[path];

View File

@ -0,0 +1,58 @@
// Interface automatically generated by schemas-to-ts
import { YogaPriceComponent } from './yoga-price-component';
import { YogaDiscountComponent } from './yoga-discount-component';
import { YogaBlogPostsComponent } from './yoga-blog-posts-component';
import { YogaSubscribeNowComponent } from './yoga-subscribe-now-component';
import { YogaFooter } from './yoga-footer';
import { YogaPriceComponent_Plain } from './yoga-price-component';
import { YogaDiscountComponent_Plain } from './yoga-discount-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 PricesPage {
id: number;
attributes: {
createdAt: Date; updatedAt: Date; publishedAt?: Date; header?: string;
description?: string;
price?: { data: YogaPriceComponent };
discount?: { data: YogaDiscountComponent };
blogs?: { data: YogaBlogPostsComponent };
subscribe?: { data: YogaSubscribeNowComponent };
footer?: { data: YogaFooter };
};
}
export interface PricesPage_Plain {
id: number;
createdAt: Date; updatedAt: Date; publishedAt?: Date; header?: string;
description?: string;
price?: YogaPriceComponent_Plain;
discount?: YogaDiscountComponent_Plain;
blogs?: YogaBlogPostsComponent_Plain;
subscribe?: YogaSubscribeNowComponent_Plain;
footer?: YogaFooter_Plain;
}
export interface PricesPage_NoRelations {
id: number;
createdAt: Date; updatedAt: Date; publishedAt?: Date; header?: string;
description?: string;
price?: number;
discount?: number;
blogs?: number;
subscribe?: number;
footer?: number;
}
export interface PricesPage_AdminPanelLifeCycle {
id: number;
createdAt: Date; updatedAt: Date; publishedAt?: Date; header?: string;
description?: string;
price?: AdminPanelRelationPropertyModification<YogaPriceComponent_Plain>;
discount?: AdminPanelRelationPropertyModification<YogaDiscountComponent_Plain>;
blogs?: AdminPanelRelationPropertyModification<YogaBlogPostsComponent_Plain>;
subscribe?: AdminPanelRelationPropertyModification<YogaSubscribeNowComponent_Plain>;
footer?: AdminPanelRelationPropertyModification<YogaFooter_Plain>;
}

View File

@ -0,0 +1,58 @@
// Interface automatically generated by schemas-to-ts
import { YogaPriceComponent } from './yoga-price-component';
import { YogaDiscountComponent } from './yoga-discount-component';
import { YogaBlogPostsComponent } from './yoga-blog-posts-component';
import { YogaSubscribeNowComponent } from './yoga-subscribe-now-component';
import { YogaFooter } from './yoga-footer';
import { YogaPriceComponent_Plain } from './yoga-price-component';
import { YogaDiscountComponent_Plain } from './yoga-discount-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 PricesPage {
id: number;
attributes: {
createdAt: Date; updatedAt: Date; publishedAt?: Date; header?: string;
description?: string;
price?: { data: YogaPriceComponent };
discount?: { data: YogaDiscountComponent };
blogs?: { data: YogaBlogPostsComponent };
subscribe?: { data: YogaSubscribeNowComponent };
footer?: { data: YogaFooter };
};
}
export interface PricesPage_Plain {
id: number;
createdAt: Date; updatedAt: Date; publishedAt?: Date; header?: string;
description?: string;
price?: YogaPriceComponent_Plain;
discount?: YogaDiscountComponent_Plain;
blogs?: YogaBlogPostsComponent_Plain;
subscribe?: YogaSubscribeNowComponent_Plain;
footer?: YogaFooter_Plain;
}
export interface PricesPage_NoRelations {
id: number;
createdAt: Date; updatedAt: Date; publishedAt?: Date; header?: string;
description?: string;
price?: number;
discount?: number;
blogs?: number;
subscribe?: number;
footer?: number;
}
export interface PricesPage_AdminPanelLifeCycle {
id: number;
createdAt: Date; updatedAt: Date; publishedAt?: Date; header?: string;
description?: string;
price?: AdminPanelRelationPropertyModification<YogaPriceComponent_Plain>;
discount?: AdminPanelRelationPropertyModification<YogaDiscountComponent_Plain>;
blogs?: AdminPanelRelationPropertyModification<YogaBlogPostsComponent_Plain>;
subscribe?: AdminPanelRelationPropertyModification<YogaSubscribeNowComponent_Plain>;
footer?: AdminPanelRelationPropertyModification<YogaFooter_Plain>;
}

View File

@ -0,0 +1,46 @@
{
"kind": "singleType",
"collectionName": "prices_pages",
"info": {
"singularName": "prices-page",
"pluralName": "prices-pages",
"displayName": "PricesPage"
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {},
"attributes": {
"header": {
"type": "string"
},
"description": {
"type": "text"
},
"price": {
"type": "relation",
"relation": "oneToOne",
"target": "api::yoga-price-component.yoga-price-component"
},
"discount": {
"type": "relation",
"relation": "oneToOne",
"target": "api::yoga-discount-component.yoga-discount-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"
}
}
}

View File

@ -0,0 +1,7 @@
/**
* prices-page controller
*/
import { factories } from '@strapi/strapi'
export default factories.createCoreController('api::prices-page.prices-page');

View File

@ -0,0 +1,7 @@
/**
* prices-page router
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreRouter('api::prices-page.prices-page');

View File

@ -0,0 +1,7 @@
/**
* prices-page service
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreService('api::prices-page.prices-page');

View File

@ -700,6 +700,55 @@ export interface ApiPersonPerson extends Struct.SingleTypeSchema {
}; };
} }
export interface ApiPricesPagePricesPage extends Struct.SingleTypeSchema {
collectionName: 'prices_pages';
info: {
displayName: 'PricesPage';
pluralName: 'prices-pages';
singularName: 'prices-page';
};
options: {
draftAndPublish: true;
};
attributes: {
blogs: Schema.Attribute.Relation<
'oneToOne',
'api::yoga-blog-posts-component.yoga-blog-posts-component'
>;
createdAt: Schema.Attribute.DateTime;
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
Schema.Attribute.Private;
description: Schema.Attribute.Text;
discount: Schema.Attribute.Relation<
'oneToOne',
'api::yoga-discount-component.yoga-discount-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::prices-page.prices-page'
> &
Schema.Attribute.Private;
price: Schema.Attribute.Relation<
'oneToOne',
'api::yoga-price-component.yoga-price-component'
>;
publishedAt: Schema.Attribute.DateTime;
subscribe: Schema.Attribute.Relation<
'oneToOne',
'api::yoga-subscribe-now-component.yoga-subscribe-now-component'
>;
updatedAt: Schema.Attribute.DateTime;
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
Schema.Attribute.Private;
};
}
export interface ApiServicesPageServicesPage extends Struct.SingleTypeSchema { export interface ApiServicesPageServicesPage extends Struct.SingleTypeSchema {
collectionName: 'services_pages'; collectionName: 'services_pages';
info: { info: {
@ -2252,6 +2301,7 @@ declare module '@strapi/strapi' {
'api::home.home': ApiHomeHome; 'api::home.home': ApiHomeHome;
'api::page.page': ApiPagePage; 'api::page.page': ApiPagePage;
'api::person.person': ApiPersonPerson; 'api::person.person': ApiPersonPerson;
'api::prices-page.prices-page': ApiPricesPagePricesPage;
'api::services-page.services-page': ApiServicesPageServicesPage; 'api::services-page.services-page': ApiServicesPageServicesPage;
'api::yoga-about-us-component.yoga-about-us-component': ApiYogaAboutUsComponentYogaAboutUsComponent; '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-about-us-with-boxes-component.yoga-about-us-with-boxes-component': ApiYogaAboutUsWithBoxesComponentYogaAboutUsWithBoxesComponent;