-
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.
Add code to generate scores from notion database
- Loading branch information
Showing
4 changed files
with
228 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,3 @@ | ||
.env | ||
node_modules | ||
scores.json |
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,30 @@ | ||
require('dotenv').config(); | ||
const { Client } = require('@notionhq/client'); | ||
|
||
const notion = new Client({ auth: process.env.NOTION_API_KEY }); | ||
|
||
(async () => { | ||
const databaseId = 'aec8e648244c4b42a19d172f9fe9f1aa'; | ||
const response = await notion.databases.query({ | ||
database_id: databaseId, | ||
sorts: [ | ||
{ | ||
property: 'BP account', | ||
direction: 'ascending', | ||
}, | ||
], | ||
}); | ||
|
||
let scores = []; | ||
|
||
response.results.map(res => { | ||
scores.push({ | ||
"guild": res.properties['BP account'].rich_text[0].text.content, | ||
"score": res.properties.Total.number * 10000 | ||
}); | ||
}); | ||
|
||
console.log(`${scores.length} guilds were scored`); | ||
console.log(scores); | ||
|
||
})(); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,24 @@ | ||
{ | ||
"name": "notion-tools", | ||
"version": "0.0.1", | ||
"description": "tool to fetch scores from notion database", | ||
"main": "index.js", | ||
"scripts": { | ||
"start": "NODE_ENV=production && node index.js", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/wax-office-of-inspector-general/office.git" | ||
}, | ||
"author": "rakeden", | ||
"license": "UNLICENSED", | ||
"bugs": { | ||
"url": "https://github.com/wax-office-of-inspector-general/office/issues" | ||
}, | ||
"homepage": "https://github.com/wax-office-of-inspector-general/office#readme", | ||
"devDependencies": { | ||
"@notionhq/client": "^2.2.14", | ||
"dotenv": "^16.4.5" | ||
} | ||
} |
54de86f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rakeden hi ,I'm looking for someone with your stack to work on our platform as a freelancer or full time . some projects start soon and others begin in half a year . are you up ? contact me on telegram @eliasdiek or via email at [email protected]