-
Notifications
You must be signed in to change notification settings - Fork 410
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 #1533 from filipedeschamps/read-votes-others
[Moderação] Possibilidade de ver `usernames` no grafo de qualificações
- Loading branch information
Showing
8 changed files
with
508 additions
and
79 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
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
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,31 @@ | ||
import { formatISO } from 'date-fns'; | ||
import nextConnect from 'next-connect'; | ||
|
||
import analytics from 'models/analytics'; | ||
import authentication from 'models/authentication'; | ||
import authorization from 'models/authorization'; | ||
import cacheControl from 'models/cache-control'; | ||
import controller from 'models/controller.js'; | ||
|
||
export default nextConnect({ | ||
attachParams: true, | ||
onNoMatch: controller.onNoMatchHandler, | ||
onError: controller.onErrorHandler, | ||
}) | ||
.use(controller.injectRequestMetadata) | ||
.use(authentication.injectAnonymousOrUser) | ||
.use(controller.logRequest) | ||
.use(cacheControl.noCache) | ||
.get(authorization.canRequest('read:votes:others'), getHandler); | ||
|
||
async function getHandler(_, response) { | ||
const votesGraph = await analytics.getVotesGraph({ | ||
limit: 1000, | ||
showUsernames: true, | ||
}); | ||
|
||
return response.json({ | ||
updated_at: formatISO(Date.now()), | ||
votesGraph, | ||
}); | ||
} |
Oops, something went wrong.
85d6e91
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.
Successfully deployed to the following URLs:
tabnews – ./
tabnews-git-main-tabnews.vercel.app
tabnews-tabnews.vercel.app
tabnews.com.br
www.tabnews.com.br