Skip to content

Comments

Implement blog listing endpoint with Clean Architecture#1

Open
Copilot wants to merge 3 commits intomainfrom
copilot/create-blog-listing
Open

Implement blog listing endpoint with Clean Architecture#1
Copilot wants to merge 3 commits intomainfrom
copilot/create-blog-listing

Conversation

Copy link

Copilot AI commented Feb 11, 2026

Adds GET /api/blogs endpoint to retrieve blog posts from the database.

Changes

  • Schema: Added Blog model (Prisma) with fields: title, content, author, published, timestamps
  • Domain layer: Blog entity and IBlogRepository interface (framework-agnostic)
  • Repository: BlogRepository implementation using Prisma client
  • Use case: ListBlogsUseCase for retrieval orchestration
  • Controller: BlogController handles HTTP concerns, returns ApiResponse<Blog[]>
  • Routes: Registered at /api/blogs via dedicated route file

Architecture

Follows dependency injection pattern: Repository → UseCase → Controller

// routes/index.ts
const blogRepository = new BlogRepository();
const listBlogsUseCase = new ListBlogsUseCase(blogRepository);
const blogController = new BlogController(listBlogsUseCase);

Dependencies point inward per Clean Architecture. Controllers bound with .bind() when registered.

Response Format

{
  "success": true,
  "data": [
    {
      "id": 1,
      "title": "Getting Started with TypeScript",
      "content": "...",
      "author": "John Doe",
      "published": true,
      "createdAt": "2026-02-11T23:39:43.524Z",
      "updatedAt": "2026-02-11T23:39:43.524Z"
    }
  ]
}

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • checkpoint.prisma.io
    • Triggering command: /opt/hostedtoolcache/node/24.13.0/x64/bin/node /opt/hostedtoolcache/node/24.13.0/x64/bin/node /home/REDACTED/work/test-auto-copilot/test-auto-copilot/node_modules/prisma/build/child {&#34;product&#34;:&#34;prisma&#34;,&#34;version&#34;:&#34;5.22.0&#34;,&#34;cli_install_type&#34;:&#34;local&#34;,&#34;information&#34;:&#34;&#34;,&#34;local_timestamp&#34;:&#34;2026-02-11T23:37:56Z&#34;,&#34;project_hash&#34;:&#34;eaa95e42&#34;,&#34;cli_path&#34;:&#34;/home/REDACTED/work/test-auto-copilot/test-auto-copilot/node_modules/prisma/build/index.js&#34;,&#34;cl (dns block)
    • Triggering command: /opt/hostedtoolcache/node/24.13.0/x64/bin/node /opt/hostedtoolcache/node/24.13.0/x64/bin/node /home/REDACTED/work/test-auto-copilot/test-auto-copilot/node_modules/prisma/build/child {&#34;product&#34;:&#34;prisma&#34;,&#34;version&#34;:&#34;5.22.0&#34;,&#34;cli_install_type&#34;:&#34;local&#34;,&#34;information&#34;:&#34;&#34;,&#34;local_timestamp&#34;:&#34;2026-02-11T23:38:23Z&#34;,&#34;project_hash&#34;:&#34;eaa95e42&#34;,&#34;cli_path&#34;:&#34;/home/REDACTED/work/test-auto-copilot/test-auto-copilot/node_modules/.bin/prisma&#34;,&#34;cli_path_has (dns block)
    • Triggering command: /opt/hostedtoolcache/node/24.13.0/x64/bin/node /opt/hostedtoolcache/node/24.13.0/x64/bin/node /home/REDACTED/work/test-auto-copilot/test-auto-copilot/node_modules/prisma/build/child {&#34;product&#34;:&#34;prisma&#34;,&#34;version&#34;:&#34;5.22.0&#34;,&#34;cli_install_type&#34;:&#34;local&#34;,&#34;information&#34;:&#34;&#34;,&#34;local_timestamp&#34;:&#34;2026-02-11T23:38:29Z&#34;,&#34;project_hash&#34;:&#34;eaa95e42&#34;,&#34;cli_path&#34;:&#34;/home/REDACTED/work/test-auto-copilot/test-auto-copilot/node_modules/.bin/prisma&#34;,&#34;cli_path_has (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Crie a listagem de blogs

The user has attached the following uncommitted or modified files as relevant context:
.github/copilot-instructions.md
diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md
index 388b01f..849d7ae 100644
--- a/.github/copilot-instructions.md
+++ b/.github/copilot-instructions.md
@@ -212,7 +212,4 @@ npm run test:coverage # Generate test coverage report

Security

  • Body parsing limits: Use Express defaults (consider adding explicit limits for production)
    -- Error responses: Stack traces hidden in non-development environments

-Spec D D --- Waterfall
\ No newline at end of file
+- Error responses: Stack traces hidden in non-development environments
\ No newline at end of file

.github/copilot-instructions.md

Created from VS Code.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: argentinaluiz <4926329+argentinaluiz@users.noreply.github.com>
Copilot AI changed the title [WIP] Add blog listing feature Implement blog listing endpoint with Clean Architecture Feb 11, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Implements a new blog listing feature in the Express + TypeScript Clean Architecture codebase by adding a Blog model (Prisma) and the corresponding domain/repository/use-case/controller/route wiring to expose GET /api/blogs.

Changes:

  • Added Blog Prisma model + migration to persist blog entries.
  • Implemented blog domain/repository/use case/controller to support listing blogs.
  • Registered blog routes under /api and added /blogs route mapping.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
.github/copilot-instructions.md Minor documentation cleanup.
prisma/schema.prisma Adds Blog model to Prisma schema.
prisma/migrations/20260211233829_/migration.sql Creates the Blog table via migration.
src/domain/blog/Blog.ts Introduces the Blog domain entity shape.
src/domain/blog/IBlogRepository.ts Defines repository interface for blog data access.
src/repositories/blog/BlogRepository.ts Prisma-backed repository implementing blog queries.
src/useCases/blog/ListBlogsUseCase.ts Use case to list blogs from repository.
src/controllers/BlogController.ts HTTP controller for listing blogs.
src/routes/blogs.routes.ts Route definitions for blog endpoints.
src/routes/index.ts Wires blog dependencies and mounts /api/blogs.

@argentinaluiz argentinaluiz marked this pull request as ready for review February 11, 2026 23:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants