Skip to content

Commit 73c08f7

Browse files
authored
Merge pull request #63 from techknowledge-blog/feature/order-categories-and-update-seed
Order Categories and Update Seed
2 parents 593fa31 + ca5511c commit 73c08f7

File tree

4 files changed

+31
-0
lines changed

4 files changed

+31
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- AlterTable
2+
ALTER TABLE "Post" ADD COLUMN "views" INTEGER DEFAULT 0;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*
2+
Warnings:
3+
4+
- You are about to drop the column `views` on the `Post` table. All the data in the column will be lost.
5+
6+
*/
7+
-- AlterTable
8+
ALTER TABLE "Post" DROP COLUMN "views";

src/modules/posts/posts.service.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ export class PostsService {
7979
},
8080
},
8181
},
82+
orderBy: {
83+
category: {
84+
name: 'asc',
85+
},
86+
},
8287
});
8388

8489
if (!posts) {

src/seed/post.seed.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,21 @@ Trabalhar como freelancer tem sido uma jornada cheia de aprendizados, desafios e
730730
},
731731
});
732732

733+
const GENERIC_COMPONENTS = await prisma.post.upsert({
734+
where: { id: 18 },
735+
update: {},
736+
create: {
737+
title: 'Componentes Genéricos: A Arte de Não Reinventar a Roda (Parte 1)',
738+
authorId: 4,
739+
content: ``,
740+
previewContent:
741+
'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.',
742+
slug: 'componentes-genericos-arte-de-nao-reinventar-roda-parte-1',
743+
isPublished: true,
744+
categoryId: 9,
745+
},
746+
});
747+
733748
console.log({
734749
FAZ_FUNCIONAR_E_DEPOIS_MELHORA_SERA_MESMO,
735750
OLIMPIADA_DO_CONHECIMENTO,
@@ -745,5 +760,6 @@ Trabalhar como freelancer tem sido uma jornada cheia de aprendizados, desafios e
745760
COMPONENTS,
746761
TAILWINDCSS_IS_MOBILE_FIRST,
747762
TAILWINDCSS_A_POWERFUL_TOOL,
763+
GENERIC_COMPONENTS,
748764
});
749765
}

0 commit comments

Comments
 (0)