-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from calimania/feat/markket-content-type
created markket content type and associated resources
- Loading branch information
Showing
7 changed files
with
142 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"kind": "collectionType", | ||
"collectionName": "markkets", | ||
"info": { | ||
"singularName": "markket", | ||
"pluralName": "markkets", | ||
"displayName": "Markket", | ||
"description": "Instance of a markket - usage records" | ||
}, | ||
"options": { | ||
"draftAndPublish": true | ||
}, | ||
"pluginOptions": {}, | ||
"attributes": { | ||
"Key": { | ||
"type": "string", | ||
"required": true | ||
}, | ||
"Content": { | ||
"type": "json", | ||
"required": true | ||
}, | ||
"user_key_or_id": { | ||
"type": "string", | ||
"required": false | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* markket controller | ||
*/ | ||
import { version } from '../../../../package.json'; | ||
const { createCoreController } = require('@strapi/strapi').factories; | ||
const modelId = "api::markket.markket"; | ||
|
||
const NODE_ENV = process.env.NODE_ENV || 'development'; | ||
const STRIPE_PUBLIC_KEY = process.env.STRIPE_PUBLIC_KEY || 'n/a'; | ||
const SENDGRID_REPLY_TO_EMAIL = process.env.SENDGRID_REPLY_TO_EMAIL || 'n/a'; | ||
|
||
module.exports = createCoreController(modelId, ({ strapi }) => ({ | ||
async about(ctx: any) { | ||
console.info('markket.get'); | ||
ctx.send({ | ||
message: 'This is the about endpoint', | ||
data: { | ||
info: 'Markket.place is an international commercial community', | ||
version, | ||
NODE_ENV, | ||
STRIPE_PUBLIC_KEY, | ||
SENDGRID_REPLY_TO_EMAIL, | ||
}, | ||
}); | ||
}, | ||
async create(ctx: any) { | ||
console.info('markket.create'); | ||
await strapi.service(modelId).create({ | ||
locale: 'en', | ||
data: { | ||
Key: "markket.create", | ||
Content: ctx.request.body, | ||
user_key_or_id: "", // @TODO: Review authorization, token or related user | ||
} | ||
}); | ||
// @TODO: send notification emails, perform STRIPE actions, etc, here | ||
ctx.send({ | ||
message: 'This is the create endpoint', | ||
data: { | ||
info: 'Markket.place is an international commercial community', | ||
version, | ||
}, | ||
}); | ||
} | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* Markket router | ||
*/ | ||
|
||
module.exports = { | ||
routes: [ | ||
{ | ||
method: 'GET', | ||
path: '/markket', | ||
handler: 'markket.about', | ||
config: { | ||
policies: [], | ||
middlewares: [], | ||
}, | ||
}, | ||
{ | ||
method: 'POST', | ||
path: '/markket', | ||
handler: 'markket.create', | ||
config: { | ||
policies: [], | ||
middlewares: [], | ||
}, | ||
} | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/** | ||
* markket service | ||
*/ | ||
|
||
import { factories } from '@strapi/strapi'; | ||
|
||
export default factories.createCoreService('api::markket.markket'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters