-
Notifications
You must be signed in to change notification settings - Fork 5
Feature | Add projects review screen #4
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
base: goncypozzo
Are you sure you want to change the base?
Conversation
|
Someone is attempting to deploy a commit to a Personal Account owned by @goncy on Vercel. @goncy first needs to authorize it. |
| "@react-three/drei": "^9.57.0", | ||
| "@react-three/fiber": "^8.11.9", | ||
| "@react-three/postprocessing": "^2.7.0", | ||
| "axios": "^1.4.0", |
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.
Es necesario? Axios no solo pesa bastante sino que evita que podamos usar el cache del fetch nativo
| "@types/three": "^0.149.0", | ||
| "@typescript-eslint/eslint-plugin": "^5.59.7", | ||
| "@typescript-eslint/parser": "^5.59.7", | ||
| "discord-api-types": "^0.37.43", |
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.
Imagino es una lib de types, podriamos copiar un par de los tipos que necesitamos al package de types e importarlos?
| @@ -0,0 +1,10 @@ | |||
| import { Provider as SocketProvider } from "@/socket/context"; | |||
| import ProjectsScreen from "~/modules/projects/screens"; | |||
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.
Los imports de modules deberian ser desde @/projects, una cosa minima es que los modulos son en singular (project en vez de projects)
| const api = { | ||
| messages: { | ||
| fetch: async (channelID: APIChannel["id"]): Promise<APIMessage[]> => { | ||
| const url = `http://localhost:6600/api/discord/messages?channel_id=${channelID}`; |
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.
Los fetches, idealmente se hacen desde el lado del server, de esa manera evitas un roundtrip a tu propio server y tener que hardcodear un domain
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.
En caso de que los fetch sean del lado del cliente se suele crear una carpeta api y adentro un archivo client.ts. Los archivos del client, si van hacia una api route o route handler, fetchean de /api/discord... en vez del path completo, asi es mas facil de abstraerse
|
|
||
| return res.data.data; | ||
| }, | ||
| addReaction: async ( |
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.
Generalmente aca nesteas el objeto para ir tipo reaction.add, reaction.delete
|
|
||
| return res.data; | ||
| }, | ||
| fetchChannels: async (guildID: APIGuild["id"]): Promise<APIChannel[]> => { |
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.
Esto seria fetch y list
Summary
Add a screen for project review that connects with Discord messages and the voting screen.
Client
axios.discord api typesfor the Discord service.Projectsmodule.Votemodule to handle socket events.Server
dotenvand addedDISCORD_TOKENto the environment for the bot token..gitignorecorsto allow calls from localhost.Images
eb12b3ccf5372fd3dc1f92f31f472972.mp4
942d93e17626e1aff32e92d60767d824.mp4
Endpoints
Get messages
GET /api/discord/messages?channel_idchannel_idstringAdd reaction
POST /api/discord/messages/reaction/${id}idstringRequest Body
{ emoji: "✅" channel_id: "1111515860696313886" }emojistringchannel_idstringDelete reaction
DELETE /api/discord/messages/reaction/${id}idstringRequest Body
{ emoji: "⌛" channel_id: "1111515860696313886" }emojistringchannel_idstringGet guild info
GET /api/discord/guilds?guild_idguild_idstringGet guild channels
GET /api/discord/guilds/channels?guild_idguild_idstring