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

Multiple content type changes to support future features #2

Merged
merged 1 commit into from
Oct 13, 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
18 changes: 18 additions & 0 deletions docs/db.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Database

## Postgress

Deploying to a database in our droplet, will migrate as we scale to more robust offers.

## Migration Path

If you start with a self-managed setup, plan for a future migration to a managed database. Here’s a simple migration path:

Regular Backups: Ensure you have automated and reliable backups of your database.

Monitoring and Alerts: Set up monitoring and alerts to keep track of database performance and issues.

Testing Migration: Periodically test the migration process to a managed database to ensure you can switch smoothly when needed.

Scalability Plan: Monitor your application’s growth and database performance to anticipate when a managed database might become necessary.

27 changes: 27 additions & 0 deletions docs/debug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Debugging

Common useful commands to get out of situations.

## Missing content types

Error examples:

```bash

ERROR in ./src/api/subscriber/services/subscriber.ts:7:44
TS2345: Argument of type '"api::subscriber.subscriber"' is not assignable to parameter of type 'ContentType'.
5 | import { factories } from '@strapi/strapi';
6 |
> 7 | export default factories.createCoreService('api::subscriber.subscriber');

```

Possible Solution:

```bash

## Run a strapi typescript command to regenerate

yarn strapi ts:generate-types

```
45 changes: 45 additions & 0 deletions docs/email.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Email API

Choosing between Mailchimp and SendGrid depends on your specific needs for email services. Here’s a comparison to help you decide which might be better for your Strapi integration:

SendGrid
Pros:

Transactional Emails: SendGrid is highly focused on transactional emails, which are crucial for order confirmations, password resets, etc.
Developer-Friendly: Provides robust APIs, great documentation, and easy integration with backend services like Strapi.
Email Deliverability: Known for high deliverability rates.
Scalability: Suitable for both small-scale and large-scale email needs.
Cons:

Learning Curve: For users not familiar with email APIs, there might be a slight learning curve.
Cost: Depending on the volume of emails, the cost can increase.
Mailchimp
Pros:

Email Marketing: Mailchimp excels in email marketing with great tools for creating and managing campaigns.
All-in-One: Offers additional features like marketing automation, audience management, and detailed analytics.
User-Friendly: Easy-to-use interface for users who are not technically inclined.
Integration with E-commerce: Integrates well with e-commerce platforms for marketing campaigns.
Cons:

Transactional Emails: While Mailchimp does offer transactional email services through Mandrill, it’s primarily focused on marketing emails.
Pricing: Can become expensive as you add more features and contacts.
Decision Points
Transactional Emails: If your primary need is to send transactional emails (e.g., order confirmations, password resets), SendGrid is likely the better choice.
Email Marketing: If you need to run marketing campaigns and handle audience management, Mailchimp might be more suitable.
Ease of Integration: For a developer-friendly API and straightforward integration with Strapi, SendGrid might be easier.
Additional Features: If you need additional marketing features, Mailchimp provides a more comprehensive suite.
Ethical Considerations: Intuit vs. Twilio
Intuit: Known for its financial software products (TurboTax, QuickBooks), Intuit has faced criticism over its lobbying efforts and business practices, especially related to making tax filing more difficult to drive users to its paid services.
Twilio: Generally viewed as more developer-focused and transparent, though like any large company, it has had its share of controversies.
Conclusion
For integrating with Strapi to handle a marketplace that supports multiple vendors, SendGrid might be the better choice due to its strong focus on transactional email and ease of integration with backend services. However, if you need more comprehensive marketing features, Mailchimp could be considered, keeping in mind the additional complexity and cost.

If ethical considerations are a significant factor in your decision, Twilio (SendGrid’s parent company) might align more closely with your values compared to Intuit (Mailchimp’s parent company).







16 changes: 16 additions & 0 deletions src/api/article/content-types/article/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,22 @@
"relation": "manyToMany",
"target": "api::store.store",
"inversedBy": "articles"
},
"Tags": {
"type": "component",
"repeatable": true,
"component": "common.tag"
},
"SEO": {
"type": "component",
"repeatable": true,
"component": "common.seo"
},
"category": {
"type": "relation",
"relation": "manyToOne",
"target": "api::category.category",
"inversedBy": "articles"
}
}
}
49 changes: 49 additions & 0 deletions src/api/category/content-types/category/schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"kind": "collectionType",
"collectionName": "categories",
"info": {
"singularName": "category",
"pluralName": "categories",
"displayName": "Category",
"description": ""
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {},
"attributes": {
"articles": {
"type": "relation",
"relation": "oneToMany",
"target": "api::article.article",
"mappedBy": "category"
},
"store": {
"type": "relation",
"relation": "manyToOne",
"target": "api::store.store",
"inversedBy": "categories"
},
"Name": {
"type": "string",
"required": true
},
"slug": {
"type": "string",
"unique": true,
"required": true
},
"SEO": {
"type": "component",
"repeatable": false,
"component": "common.seo"
},
"Description": {
"type": "string"
},
"Active": {
"type": "boolean",
"default": true
}
}
}
7 changes: 7 additions & 0 deletions src/api/category/controllers/category.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* category controller
*/

import { factories } from '@strapi/strapi'

export default factories.createCoreController('api::category.category');
7 changes: 7 additions & 0 deletions src/api/category/routes/category.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* category router
*/

import { factories } from '@strapi/strapi';

export default factories.createCoreRouter('api::category.category');
7 changes: 7 additions & 0 deletions src/api/category/services/category.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* category service
*/

import { factories } from '@strapi/strapi';

export default factories.createCoreService('api::category.category');
45 changes: 45 additions & 0 deletions src/api/inbox/content-types/inbox/schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"kind": "collectionType",
"collectionName": "inboxes",
"info": {
"singularName": "inbox",
"pluralName": "inboxes",
"displayName": "Inbox",
"description": ""
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {},
"attributes": {
"Name": {
"type": "string",
"required": true
},
"Message": {
"type": "text"
},
"email": {
"type": "email",
"required": true
},
"store": {
"type": "relation",
"relation": "oneToOne",
"target": "api::store.store"
},
"Archived": {
"type": "boolean"
},
"parentMessageId": {
"type": "relation",
"relation": "oneToOne",
"target": "api::inbox.inbox"
},
"admin_user": {
"type": "relation",
"relation": "oneToOne",
"target": "admin::user"
}
}
}
7 changes: 7 additions & 0 deletions src/api/inbox/controllers/inbox.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* inbox controller
*/

import { factories } from '@strapi/strapi'

export default factories.createCoreController('api::inbox.inbox');
7 changes: 7 additions & 0 deletions src/api/inbox/routes/inbox.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* inbox router
*/

import { factories } from '@strapi/strapi';

export default factories.createCoreRouter('api::inbox.inbox');
7 changes: 7 additions & 0 deletions src/api/inbox/services/inbox.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* inbox service
*/

import { factories } from '@strapi/strapi';

export default factories.createCoreService('api::inbox.inbox');
10 changes: 10 additions & 0 deletions src/api/order/content-types/order/lifecycles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
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();
},
};
58 changes: 55 additions & 3 deletions src/api/order/content-types/order/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,67 @@
"info": {
"singularName": "order",
"pluralName": "orders",
"displayName": "Order"
"displayName": "Order",
"description": ""
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {},
"attributes": {
"Item": {
"type": "json"
"store": {
"type": "relation",
"relation": "oneToOne",
"target": "api::store.store"
},
"Amount": {
"type": "decimal"
},
"Currency": {
"type": "string"
},
"Status": {
"type": "enumeration",
"enum": [
"pending",
"complete",
"refunded"
]
},
"STRIPE_PAYMENT_ID": {
"type": "string"
},
"Shipping_Address": {
"type": "component",
"repeatable": false,
"component": "common.links"
},
"Details": {
"displayName": "PRODUCT_SNAPSHOP",
"type": "component",
"repeatable": true,
"component": "common.product-snapshop"
},
"uuid": {
"type": "uid",
"required": true
},
"buyer": {
"type": "relation",
"relation": "oneToOne",
"target": "admin::user"
},
"Payment_attempts": {
"displayName": "Payment_attempts",
"type": "component",
"repeatable": true,
"component": "common.payment-attempts"
},
"shipments": {
"type": "relation",
"relation": "oneToMany",
"target": "api::shipment.shipment",
"mappedBy": "order"
}
}
}
Loading
Loading