Skip to content

Commit

Permalink
added into strapi
Browse files Browse the repository at this point in the history
  • Loading branch information
nik23122000 committed Apr 14, 2022
1 parent aa0fce6 commit 21704ff
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 4 deletions.
7 changes: 3 additions & 4 deletions app/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { fetchAPI } from '../lib/api';
import { withFirebaseAuthUser } from '../components/auth/firebase';

function Home(props) {
console.log(props);
return (
<>
<Head>
Expand Down Expand Up @@ -68,7 +67,7 @@ function Home(props) {
<h2 className={`mx-auto w-auto m-5 ${styles.title}`}>
Community Activity
</h2>
<Discourserankedlist activities={props.communityActivities}></Discourserankedlist>
<Discourserankedlist activities={props.discourses}></Discourserankedlist>
</div>
</Container>
</>
Expand All @@ -83,13 +82,13 @@ export async function getStaticProps({ params }) {
const releaseNotes = await fetchAPI('/release-notes');
const infotiles=await fetchAPI('/infotiles');
const counters=await fetchAPI('/counters');
const communityActivities=await fetchAPI('/community-activities');
const discourses=await fetchAPI('/discourses');
const topNavItems = await fetchAPI('/top-nav-item');



return {
props: { carousels, persons, guides, releaseNotes, topNavItems,infotiles,counters,communityActivities },
props: { carousels, persons, guides, releaseNotes, topNavItems,infotiles,counters,discourses },
// Next.js will attempt to re-generate the page:
// - When a request comes in
// - At most once every 1 second
Expand Down
52 changes: 52 additions & 0 deletions cms/api/discourse/config/routes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"routes": [
{
"method": "GET",
"path": "/discourses",
"handler": "discourse.find",
"config": {
"policies": []
}
},
{
"method": "GET",
"path": "/discourses/count",
"handler": "discourse.count",
"config": {
"policies": []
}
},
{
"method": "GET",
"path": "/discourses/:id",
"handler": "discourse.findOne",
"config": {
"policies": []
}
},
{
"method": "POST",
"path": "/discourses",
"handler": "discourse.create",
"config": {
"policies": []
}
},
{
"method": "PUT",
"path": "/discourses/:id",
"handler": "discourse.update",
"config": {
"policies": []
}
},
{
"method": "DELETE",
"path": "/discourses/:id",
"handler": "discourse.delete",
"config": {
"policies": []
}
}
]
}
8 changes: 8 additions & 0 deletions cms/api/discourse/controllers/discourse.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict';

/**
* Read the documentation (https://strapi.io/documentation/developer-docs/latest/development/backend-customization.html#core-controllers)
* to customize this controller
*/

module.exports = {};
8 changes: 8 additions & 0 deletions cms/api/discourse/models/discourse.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict';

/**
* Read the documentation (https://strapi.io/documentation/developer-docs/latest/development/backend-customization.html#lifecycle-hooks)
* to customize this model
*/

module.exports = {};
27 changes: 27 additions & 0 deletions cms/api/discourse/models/discourse.settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"kind": "collectionType",
"collectionName": "discourses",
"info": {
"name": "discourse"
},
"options": {
"increments": true,
"timestamps": true,
"draftAndPublish": true
},
"pluginOptions": {},
"attributes": {
"title": {
"type": "text"
},
"time": {
"type": "string"
},
"upvotes": {
"type": "biginteger"
},
"comments": {
"type": "biginteger"
}
}
}
8 changes: 8 additions & 0 deletions cms/api/discourse/services/discourse.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict';

/**
* Read the documentation (https://strapi.io/documentation/developer-docs/latest/development/backend-customization.html#core-services)
* to customize this service
*/

module.exports = {};

0 comments on commit 21704ff

Please sign in to comment.