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"; 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) { 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, }); }