Skip to content

feat: foro v1#197

Draft
MatiasDG539 wants to merge 7 commits intotestingfrom
pcn_forum
Draft

feat: foro v1#197
MatiasDG539 wants to merge 7 commits intotestingfrom
pcn_forum

Conversation

@MatiasDG539
Copy link
Collaborator

Preview V1.0 del foro de PCN con las siguientes funcionalidades:

  1. Restrinccion de uso de foro si no estas registrado/logueado
Screencast.from.2025-07-21.16-06-48.webm
  1. Preview creacion de post y preview vista individual de post (ambas con soporte de markdown text)
Screencast.from.2025-07-21.16-08-24.webm
  1. Borrado de post solo si sos el autor del mismo
Screencast.from.2025-07-21.16-09-55.webm
  1. Funcion para editar el post si sos el autor del mismo
Screencast.from.2025-07-21.16-11-12.webm

…elationships; update seed.ts with completion data
… post pages

- Added basic CategoryPage layout.
- Created initial ThreadDetailPage structure.
- Scaffolded CreatePostForm UI without submission logic.
- Added placeholder NewPostButton component.
- Updated sidebar with static forum link.
- Implemented logic to create new posts via CreatePostForm.
- Added utilities and libraries to parse and render markdown content.
- Integrated category selection in post creation flow.
@MatiasDG539 MatiasDG539 requested a review from agustin-sanc July 21, 2025 19:13
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 21, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Collaborator

@agustin-sanc agustin-sanc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Muy buen trabajo hasta ahora Mati! Dejé algunos comentarios

Comment on lines +155 to +156
isPinned Boolean @default(false)
isLocked Boolean @default(false)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Estos nombres podrian ser simplificados a pinned y locked

Comment on lines +83 to +86
return {
success: true,
post,
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Por qué estamos retornando success true aquí? El patrón que usamos es que si la server action retorna sin lanzar un error con throw, entonces se ejecutó exitosamente

Comment on lines +19 to +35
// Obtener el ID del usuario desde las cookies/sesión
const cookieStore = await cookies();
const sessionId = cookieStore.get('sessionId')?.value;

if (!sessionId) {
throw new Error('No hay sesión activa');
}

// Buscar la sesión para obtener el userId
const session = await prisma.session.findUnique({
where: { id: sessionId },
select: { userId: true },
});

if (!session) {
throw new Error('Sesión inválida');
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Creo que pusimos esta lógica en una función porque se repetía en varias server actions

Comment on lines +94 to +96
if (error instanceof Error) {
throw error;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Este if siempre va a ser true, puede ser?

Comment on lines +50 to +53
return {
success: true,
message: 'Post eliminado exitosamente',
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Esta server action podria no retornar nada directamente cuando se ejecuta exitosamente. El mensaje de post eliminado exitosamente puede estar definido en el frontend para minimizar el traslado de data

}

return {
success: true,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ese success deberíamos sacarlo

revalidatePath(`/foro/tema/${postId}`);

return {
success: true,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Este success deberiamos sacarlo

categoryId: z.string().min(1, 'La categoría es requerida'),
});

export async function updatePost(postId: string, data: z.infer<typeof updatePostSchema>) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Un patrón copado es recibir un objeto en la entrada de una función cuando la función recibe más de un parámetro. Los beneficios de hacer eso es que el orden de los parámetros no importa cuando invocas la función, y también beneficia la lectura del código, porque podes saber mejor qué representa cada parámetro que le estas pasando. La idea seria aplicar este patrón en todas las funciones que cumplan esa condición, capaz algunas necesitan un refactor

Comment on lines +43 to +51
const totalPosts = posts.length;
const totalComments = await prisma.postComment.count({
where: {
post: {
categoryId: category.id,
},
},
});
return (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acá estaría bueno agregar un par de líneas en blanco

Suggested change
const totalPosts = posts.length;
const totalComments = await prisma.postComment.count({
where: {
post: {
categoryId: category.id,
},
},
});
return (
const totalPosts = posts.length;
const totalComments = await prisma.postComment.count({
where: {
post: {
categoryId: category.id,
},
},
});
return (

@agustin-sanc agustin-sanc changed the title Draft Pull Request - PCN Forum - V1.0 feat: foro v1 Dec 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants