Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added schema plugin and fix to category content type #5

Merged
merged 7 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions config/plugins.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
export default ({ env }) => ({
'markketplace': {
// Development is currently done in this repo and can be abstracted into plugins for easier sharing
// 'markketplace': {
// enabled: true,
// resolve: './src/plugins/markketplace'
// },
'get-strapi-schema': {
enabled: true,
resolve: './src/plugins/markketplace'
},
upload: {
config: {
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@
"scripts": {
"develop": "strapi develop",
"start": "strapi start",
"build:plugin": "npm run build --prefix src/plugins/markketplace",
"build:plugin": "echo 'skipping plugin npm run build --prefix src/plugins/markketplace'",
"build": "yarn run build:plugin && strapi build",
"strapi": "strapi",
"deploy": "strapi deploy"
},
"dependencies": {
"@strapi/plugin-cloud": "4.25.1",
"@strapi/plugin-i18n": "4.25.1",
"@strapi/plugin-users-permissions": "4.25.1",
"@strapi/plugin-cloud": "5.1.1",
"@strapi/plugin-users-permissions": "5.1.1",
"@strapi/provider-email-sendgrid": "^5.0.6",
"@strapi/strapi": "4.25.1",
"@strapi/strapi": "5.1.1",
"@types/uuid": "^10.0.0",
"esbuild": "0.16.17",
"get-strapi-schema": "^0.0.3",
"pg": "^8.12.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-router-dom": "5.3.4",
"react-router-dom": "^6.0.0",
"strapi-provider-upload-do": "^3.6.9",
"stripe": "^16.1.0",
"styled-components": "5.3.3"
"styled-components": "^6.0.0"
},
"author": {
"name": "calimania"
Expand Down
2 changes: 1 addition & 1 deletion src/api/category/content-types/category/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
"slug": {
"type": "string",
"unique": true,
"unique": false,
"required": true
},
"SEO": {
Expand Down
45 changes: 37 additions & 8 deletions src/api/order/content-types/order/lifecycles.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,39 @@
import { Event } from '@strapi/database/dist/lifecycles';

import { v4 as uuid } from 'uuid';
/*
*
* ============================================================
* WARNING: THIS FILE HAS BEEN COMMENTED OUT
* ============================================================
*
* CONTEXT:
*
* The lifecycles.js file has been commented out to prevent unintended side effects when starting Strapi 5 for the first time after migrating to the document service.
*
* STRAPI 5 introduces a new document service that handles lifecycles differently compared to previous versions. Without migrating your lifecycles to document service middlewares, you may experience issues such as:
*
* - `unpublish` actions triggering `delete` lifecycles for every locale with a published entity, which differs from the expected behavior in v4.
* - `discardDraft` actions triggering both `create` and `delete` lifecycles, leading to potential confusion.
*
* MIGRATION GUIDE:
*
* For a thorough guide on migrating your lifecycles to document service middlewares, please refer to the following link:
* [Document Services Middlewares Migration Guide](https://docs.strapi.io/dev-docs/migration/v4-to-v5/breaking-changes/lifecycle-hooks-document-service)
*
* IMPORTANT:
*
* Simply uncommenting this file without following the migration guide may result in unexpected behavior and inconsistencies. Ensure that you have completed the migration process before re-enabling this file.
*
* ============================================================
*/

export default {
beforeCreate(event: Event) {
const { data } = event.params;
data.uuid = uuid();
},
};
// import { Event } from '@strapi/database/dist/lifecycles';
//
// import { v4 as uuid } from 'uuid';
//
// export default {
// beforeCreate(event: Event) {
// const { data } = event.params;
// data.uuid = uuid();
// },
// };
//
49 changes: 39 additions & 10 deletions src/api/shipment/content-types/shipment/lifecycles.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,41 @@
import { Event } from '@strapi/database/dist/lifecycles';

import { v4 as uuid } from 'uuid';

export default {
beforeCreate(event: Event) {
const { data } = event.params;

data.uuid = uuid();
},
};
/*
*
* ============================================================
* WARNING: THIS FILE HAS BEEN COMMENTED OUT
* ============================================================
*
* CONTEXT:
*
* The lifecycles.js file has been commented out to prevent unintended side effects when starting Strapi 5 for the first time after migrating to the document service.
*
* STRAPI 5 introduces a new document service that handles lifecycles differently compared to previous versions. Without migrating your lifecycles to document service middlewares, you may experience issues such as:
*
* - `unpublish` actions triggering `delete` lifecycles for every locale with a published entity, which differs from the expected behavior in v4.
* - `discardDraft` actions triggering both `create` and `delete` lifecycles, leading to potential confusion.
*
* MIGRATION GUIDE:
*
* For a thorough guide on migrating your lifecycles to document service middlewares, please refer to the following link:
* [Document Services Middlewares Migration Guide](https://docs.strapi.io/dev-docs/migration/v4-to-v5/breaking-changes/lifecycle-hooks-document-service)
*
* IMPORTANT:
*
* Simply uncommenting this file without following the migration guide may result in unexpected behavior and inconsistencies. Ensure that you have completed the migration process before re-enabling this file.
*
* ============================================================
*/

// import { Event } from '@strapi/database/dist/lifecycles';
//
// import { v4 as uuid } from 'uuid';
//
// export default {
// beforeCreate(event: Event) {
// const { data } = event.params;
//
// data.uuid = uuid();
// },
// };
//
//
4 changes: 2 additions & 2 deletions src/extensions/users-permissions/content-types/user/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// src/extensions/users-permissions/content-types/user/index.js
import schema from './schema.json';
import lifecycles from './lifecycles';
// import lifecycles from './lifecycles';

export default {
lifecycles,
// lifecycles,
schema,
}
45 changes: 37 additions & 8 deletions src/extensions/users-permissions/content-types/user/lifecycles.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,39 @@
import { Event } from '@strapi/database/dist/lifecycles';

import { v4 as uuid } from 'uuid';
/*
*
* ============================================================
* WARNING: THIS FILE HAS BEEN COMMENTED OUT
* ============================================================
*
* CONTEXT:
*
* The lifecycles.js file has been commented out to prevent unintended side effects when starting Strapi 5 for the first time after migrating to the document service.
*
* STRAPI 5 introduces a new document service that handles lifecycles differently compared to previous versions. Without migrating your lifecycles to document service middlewares, you may experience issues such as:
*
* - `unpublish` actions triggering `delete` lifecycles for every locale with a published entity, which differs from the expected behavior in v4.
* - `discardDraft` actions triggering both `create` and `delete` lifecycles, leading to potential confusion.
*
* MIGRATION GUIDE:
*
* For a thorough guide on migrating your lifecycles to document service middlewares, please refer to the following link:
* [Document Services Middlewares Migration Guide](https://docs.strapi.io/dev-docs/migration/v4-to-v5/breaking-changes/lifecycle-hooks-document-service)
*
* IMPORTANT:
*
* Simply uncommenting this file without following the migration guide may result in unexpected behavior and inconsistencies. Ensure that you have completed the migration process before re-enabling this file.
*
* ============================================================
*/

export default {
beforeCreate(event: Event) {
const { data } = event.params;
data.uuid = uuid();
},
};
// import { Event } from '@strapi/database/dist/lifecycles';
//
// import { v4 as uuid } from 'uuid';
//
// export default {
// beforeCreate(event: Event) {
// const { data } = event.params;
// data.uuid = uuid();
// },
// };
//
2 changes: 1 addition & 1 deletion src/plugins/markketplace/admin/src/pages/App/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
* to perform additioal custom actions for their business.
*/
import { Switch, Route } from 'react-router-dom';
import { AnErrorOccurred } from '@strapi/helper-plugin';
import pluginId from '../../pluginId';
import HomePage from '../HomePage';
import { Page } from "@strapi/strapi/admin";

const App = () => {
return (
Expand Down
Loading
Loading