From ac9832c662c5caddbbfd1e16acfa41a92363f0c3 Mon Sep 17 00:00:00 2001 From: Leticia Dias Date: Thu, 28 Aug 2025 18:16:01 -0300 Subject: [PATCH 1/3] refactor(migrations): removed views column --- .../20250826182655_add_views_to_post/migration.sql | 2 ++ .../20250826191918_remove_views_column/migration.sql | 8 ++++++++ 2 files changed, 10 insertions(+) create mode 100644 prisma/migrations/20250826182655_add_views_to_post/migration.sql create mode 100644 prisma/migrations/20250826191918_remove_views_column/migration.sql diff --git a/prisma/migrations/20250826182655_add_views_to_post/migration.sql b/prisma/migrations/20250826182655_add_views_to_post/migration.sql new file mode 100644 index 0000000..99512f4 --- /dev/null +++ b/prisma/migrations/20250826182655_add_views_to_post/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "Post" ADD COLUMN "views" INTEGER DEFAULT 0; diff --git a/prisma/migrations/20250826191918_remove_views_column/migration.sql b/prisma/migrations/20250826191918_remove_views_column/migration.sql new file mode 100644 index 0000000..af87405 --- /dev/null +++ b/prisma/migrations/20250826191918_remove_views_column/migration.sql @@ -0,0 +1,8 @@ +/* + Warnings: + + - You are about to drop the column `views` on the `Post` table. All the data in the column will be lost. + +*/ +-- AlterTable +ALTER TABLE "Post" DROP COLUMN "views"; From 3c281f1188436104c585f33faa5d258fd8a7ed0c Mon Sep 17 00:00:00 2001 From: Leticia Dias Date: Thu, 28 Aug 2025 18:58:24 -0300 Subject: [PATCH 2/3] feat(posts): added sort post categories in alphabetical order --- src/modules/posts/posts.service.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/modules/posts/posts.service.ts b/src/modules/posts/posts.service.ts index 2f68add..d59c407 100644 --- a/src/modules/posts/posts.service.ts +++ b/src/modules/posts/posts.service.ts @@ -79,6 +79,11 @@ export class PostsService { }, }, }, + orderBy: { + category: { + name: 'asc', + }, + }, }); if (!posts) { From ca5511c33f23ebc991501072432081b2a03c0d4a Mon Sep 17 00:00:00 2001 From: Leticia Dias Date: Thu, 28 Aug 2025 18:59:50 -0300 Subject: [PATCH 3/3] chore(seed): update seed --- src/seed/post.seed.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/seed/post.seed.ts b/src/seed/post.seed.ts index 3b7f1e1..4db435d 100644 --- a/src/seed/post.seed.ts +++ b/src/seed/post.seed.ts @@ -730,6 +730,21 @@ Trabalhar como freelancer tem sido uma jornada cheia de aprendizados, desafios e }, }); + const GENERIC_COMPONENTS = await prisma.post.upsert({ + where: { id: 18 }, + update: {}, + create: { + title: 'Componentes Genéricos: A Arte de Não Reinventar a Roda (Parte 1)', + authorId: 4, + content: ``, + previewContent: + 'Descubra como os componentes genéricos podem transformar sua forma de programar, evitando código duplicado e trazendo mais clareza e reutilização ao seu projeto.', + slug: 'componentes-genericos-arte-de-nao-reinventar-roda-parte-1', + isPublished: true, + categoryId: 9, + }, + }); + console.log({ FAZ_FUNCIONAR_E_DEPOIS_MELHORA_SERA_MESMO, OLIMPIADA_DO_CONHECIMENTO, @@ -745,5 +760,6 @@ Trabalhar como freelancer tem sido uma jornada cheia de aprendizados, desafios e COMPONENTS, TAILWINDCSS_IS_MOBILE_FIRST, TAILWINDCSS_A_POWERFUL_TOOL, + GENERIC_COMPONENTS, }); }