Skip to content

Commit

Permalink
feat: add images and image_types
Browse files Browse the repository at this point in the history
  • Loading branch information
fox-john committed Sep 20, 2024
1 parent 6884b2d commit 45a42ad
Show file tree
Hide file tree
Showing 17 changed files with 434 additions and 315 deletions.
8 changes: 8 additions & 0 deletions config/common/new-repository.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,11 @@ services:
PrestaShop\Module\PsEventbus\Repository\NewRepository\EmployeeRepository:
class: PrestaShop\Module\PsEventbus\Repository\NewRepository\EmployeeRepository
public: true

PrestaShop\Module\PsEventbus\Repository\NewRepository\ImageRepository:
class: PrestaShop\Module\PsEventbus\Repository\NewRepository\ImageRepository
public: true

PrestaShop\Module\PsEventbus\Repository\NewRepository\ImageTypeRepository:
class: PrestaShop\Module\PsEventbus\Repository\NewRepository\ImageTypeRepository
public: true
8 changes: 0 additions & 8 deletions config/common/repository.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,6 @@ services:
arguments:
- '@=service("prestashop.adapter.legacy.context").getContext()'

PrestaShop\Module\PsEventbus\Repository\ImageRepository:
class: PrestaShop\Module\PsEventbus\Repository\ImageRepository
public: true

PrestaShop\Module\PsEventbus\Repository\ImageTypeRepository:
class: PrestaShop\Module\PsEventbus\Repository\ImageTypeRepository
public: true

PrestaShop\Module\PsEventbus\Repository\TranslationRepository:
class: PrestaShop\Module\PsEventbus\Repository\TranslationRepository
public: true
Expand Down
12 changes: 12 additions & 0 deletions config/front/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,15 @@ services:
public: true
arguments:
- '@PrestaShop\Module\PsEventbus\Repository\NewRepository\EmployeeRepository'

PrestaShop\Module\PsEventbus\Service\ShopContent\ImagesService:
class: PrestaShop\Module\PsEventbus\Service\ShopContent\ImagesService
public: true
arguments:
- '@PrestaShop\Module\PsEventbus\Repository\NewRepository\ImageRepository'

PrestaShop\Module\PsEventbus\Service\ShopContent\ImageTypesService:
class: PrestaShop\Module\PsEventbus\Service\ShopContent\ImageTypesService
public: true
arguments:
- '@PrestaShop\Module\PsEventbus\Repository\NewRepository\ImageTypeRepository'
4 changes: 2 additions & 2 deletions e2e/src/full-sync.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe("Full Sync", () => {

it(`${shoContent} should reject full sync when ps_facebook is not installed`, async () => {
// arrange
const url = `${testConfig.prestashopUrl}/index.php?fc=module&module=ps_eventbus&controller=apiFront&is_e2e=1&shop_content=${shoContent}&limit=5&full=1&job_id=${jobId}`;
const url = `${testConfig.prestashopUrl}/index.php?fc=module&module=ps_eventbus&controller=apiFront&is_e2e=0&shop_content=${shoContent}&limit=5&full=1&job_id=${jobId}`;

const callId = { call_id: Math.random().toString(36).substring(2, 11) };

Expand All @@ -92,7 +92,7 @@ describe("Full Sync", () => {
describe.each(shopContents)("%s", (shopContent) => {
it(`${shopContent} should accept full sync`, async () => {
// arrange
const url = `${testConfig.prestashopUrl}/index.php?fc=module&module=ps_eventbus&controller=apiFront&is_e2e=1&shop_content=${shopContent}&limit=5&full=1&job_id=${jobId}`;
const url = `${testConfig.prestashopUrl}/index.php?fc=module&module=ps_eventbus&controller=apiFront&is_e2e=0&shop_content=${shopContent}&limit=5&full=1&job_id=${jobId}`;

const callId = { call_id: Math.random().toString(36).substring(2, 11) };

Expand Down
2 changes: 1 addition & 1 deletion e2e/src/helpers/data-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export async function getShopHealthCheck(options?: {
healthCheck = cachedHealthCheck;
} else {
const res = await axios.get<HealthCheck>(
`${testConfig.prestashopUrl}/index.php?fc=module&module=ps_eventbus&controller=apiFront&is_e2e=1&shop_content=healthcheck&job_id=valid-job-healthcheck`,
`${testConfig.prestashopUrl}/index.php?fc=module&module=ps_eventbus&controller=apiFront&is_e2e=0&shop_content=healthcheck&job_id=valid-job-healthcheck`,
);
healthCheck = res.data;
cachedHealthCheck = healthCheck;
Expand Down
2 changes: 1 addition & 1 deletion e2e/src/helpers/mock-probe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export function doFullSync(

const requestNext = (full: number) => {
return axios.post<PsEventbusSyncResponse>(
`${testConfig.prestashopUrl}/index.php?fc=module&module=ps_eventbus&controller=apiFront&is_e2e=1&shop_content=${shopContent}&limit=5&full=${full}&job_id=${jobId}`,
`${testConfig.prestashopUrl}/index.php?fc=module&module=ps_eventbus&controller=apiFront&is_e2e=0&shop_content=${shopContent}&limit=5&full=${full}&job_id=${jobId}`,
callId,
{
headers: {
Expand Down
2 changes: 2 additions & 0 deletions e2e/src/helpers/shop-contents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ export const shopContentMapping = {
customers: "customers",
currencies: "currencies",
employees: "employees",
images: "images",
image_types: "image-types",
} as const;

type ShopContentMapping = typeof shopContentMapping;
Expand Down
2 changes: 1 addition & 1 deletion e2e/src/job-id-validation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe("Reject invalid job-id", () => {
async (shopContent) => {
expect.assertions(6);
// arrange
const url = `${testConfig.prestashopUrl}/index.php?fc=module&module=ps_eventbus&controller=apiFront&is_e2e=1&shop_content=${shopContent}&limit=5&job_id=${jobId}`;
const url = `${testConfig.prestashopUrl}/index.php?fc=module&module=ps_eventbus&controller=apiFront&is_e2e=0&shop_content=${shopContent}&limit=5&job_id=${jobId}`;
const message$ = probe({ params: { id: jobId } });

//act
Expand Down
177 changes: 0 additions & 177 deletions src/Repository/ImageRepository.php

This file was deleted.

122 changes: 0 additions & 122 deletions src/Repository/ImageTypeRepository.php

This file was deleted.

Loading

0 comments on commit 45a42ad

Please sign in to comment.