diff --git a/prisma/migrations/20250928000245_add_article_level/migration.sql b/prisma/migrations/20250928000245_add_article_level/migration.sql new file mode 100644 index 0000000..f7ef7b9 --- /dev/null +++ b/prisma/migrations/20250928000245_add_article_level/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "Post" ADD COLUMN "article_level" TEXT; diff --git a/prisma/migrations/20250928001231_make_article_level_required/migration.sql b/prisma/migrations/20250928001231_make_article_level_required/migration.sql new file mode 100644 index 0000000..e846823 --- /dev/null +++ b/prisma/migrations/20250928001231_make_article_level_required/migration.sql @@ -0,0 +1,8 @@ +/* + Warnings: + + - Made the column `article_level` on table `Post` required. This step will fail if there are existing NULL values in that column. + +*/ +-- AlterTable +ALTER TABLE "Post" ALTER COLUMN "article_level" SET NOT NULL; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index c049da5..3548e0a 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -44,6 +44,7 @@ model Post { slug String @unique previewImageLink String? estimated_time Int @default(0) + article_level String authorId Int categoryId Int createdAt DateTime @default(now()) diff --git a/src/modules/posts/dto/create-post.dto.ts b/src/modules/posts/dto/create-post.dto.ts index f79135a..dcf8a40 100644 --- a/src/modules/posts/dto/create-post.dto.ts +++ b/src/modules/posts/dto/create-post.dto.ts @@ -25,6 +25,9 @@ export class CreatePostDto { @IsString() slug: string; + @IsString() + article_level: string; + @IsInt() authorId: number; diff --git a/src/modules/posts/posts.service.ts b/src/modules/posts/posts.service.ts index d59c407..f6b166e 100644 --- a/src/modules/posts/posts.service.ts +++ b/src/modules/posts/posts.service.ts @@ -32,6 +32,7 @@ export class PostsService { coverImageLink: data.coverImageLink, previewImageLink: data.previewImageLink, estimated_time, + article_level: data.article_level, author: { connect: { id: data.authorId } }, category: { connect: { id: data.categoryId } }, }, diff --git a/src/seed/post.seed.ts b/src/seed/post.seed.ts index 4db435d..252ab0b 100644 --- a/src/seed/post.seed.ts +++ b/src/seed/post.seed.ts @@ -52,6 +52,8 @@ Por isso, eu hoje não levo esse pensamento comigo. Posso até demorar um pouco slug: 'faz-funcionar-e-depois-melhora-sera-mesmo', isPublished: true, categoryId: 1, + article_level: '', + estimated_time: 3, }, }); @@ -91,6 +93,8 @@ No próximo post vou contar como eu (Leticia) e o Mikael nos tornamos competidor slug: 'olimpiada-do-conhecimento', isPublished: true, categoryId: 2, + article_level: '', + estimated_time: 3, }, }); @@ -134,6 +138,8 @@ Esse é apenas um dos muitos posts que vamos documentar nossa experiência duran slug: 'techknowledge-ponto-zero', isPublished: true, categoryId: 3, + article_level: '', + estimated_time: 4, }, }); @@ -163,6 +169,8 @@ Para mais informações, aqui está meu Linkedin: https://www.linkedin.com/in/mi slug: 'quem-somos-nos', isPublished: true, categoryId: 3, + article_level: '', + estimated_time: 1, }, }); @@ -224,6 +232,8 @@ O segredo está em nunca parar de aprender, manter a curiosidade viva e, princip slug: 'desafios-desenvolvedor-frontend', isPublished: true, categoryId: 1, + article_level: '', + estimated_time: 4, }, }); @@ -239,6 +249,8 @@ O segredo está em nunca parar de aprender, manter a curiosidade viva e, princip slug: 'errando-que-se-aprende', isPublished: true, categoryId: 1, + article_level: '', + estimated_time: 6, }, }); @@ -286,6 +298,8 @@ Escolha um projeto. Qualquer um. Algo que te motive. Algo que te faça pesquisar slug: 'pratique-como-ser-um-desenvolvedor', isPublished: true, categoryId: 1, + article_level: '', + estimated_time: 4, }, }); @@ -384,6 +398,8 @@ Se você também está nesse caminho, saiba que cada passo importa. E o próximo slug: 'criando-minhas-interfaces', isPublished: true, categoryId: 1, + article_level: '', + estimated_time: 7, }, }); @@ -508,6 +524,8 @@ O segredo? **Nunca parar de aprender e sempre buscar entregar valor com o que vo slug: 'desenvolvimento-mobile-2025', isPublished: true, categoryId: 7, + article_level: '', + estimated_time: 4, }, }); @@ -594,6 +612,8 @@ Para mim, tem sido uma experiência fantástica tanto profissional quanto pessoa slug: 'morar-fora-do-brasil-vale-a-pena-mesmo', isPublished: true, categoryId: 1, + article_level: '', + estimated_time: 7, }, }, ); @@ -682,6 +702,8 @@ Trabalhar como freelancer tem sido uma jornada cheia de aprendizados, desafios e slug: 'primeiros-passos-como-freelance', isPublished: true, categoryId: 8, + article_level: '', + estimated_time: 6, }, }); @@ -697,6 +719,8 @@ Trabalhar como freelancer tem sido uma jornada cheia de aprendizados, desafios e slug: 'componentes', isPublished: true, categoryId: 9, + article_level: '', + estimated_time: 8, }, }); @@ -712,6 +736,8 @@ Trabalhar como freelancer tem sido uma jornada cheia de aprendizados, desafios e slug: 'tailwind-mobile-first', isPublished: true, categoryId: 10, + article_level: '', + estimated_time: 4, }, }); @@ -727,11 +753,13 @@ Trabalhar como freelancer tem sido uma jornada cheia de aprendizados, desafios e slug: 'tailwind-uma-ferramenta-poderosa', isPublished: true, categoryId: 10, + article_level: '', + estimated_time: 5, }, }); const GENERIC_COMPONENTS = await prisma.post.upsert({ - where: { id: 18 }, + where: { id: 17 }, update: {}, create: { title: 'Componentes Genéricos: A Arte de Não Reinventar a Roda (Parte 1)', @@ -742,6 +770,25 @@ Trabalhar como freelancer tem sido uma jornada cheia de aprendizados, desafios e slug: 'componentes-genericos-arte-de-nao-reinventar-roda-parte-1', isPublished: true, categoryId: 9, + article_level: '', + estimated_time: 8, + }, + }); + + const GENERIC_COMPONENTS_02 = await prisma.post.upsert({ + where: { id: 18 }, + update: {}, + create: { + title: 'Componentes Genéricos: A Arte de Não Reinventar a Roda (Parte 2)', + authorId: 4, + content: ``, + previewContent: + 'Na Parte 2, vamos explorar quando faz sentido usar componentes genéricos e quando isso pode virar um problema. Inclui o caso real dos filtros genéricos que deu tudo errado e lições práticas para evitar armadilhas.', + slug: 'componentes-genericos-arte-de-nao-reinventar-roda-parte-2', + isPublished: true, + categoryId: 9, + article_level: '', + estimated_time: 8, }, }); @@ -761,5 +808,6 @@ Trabalhar como freelancer tem sido uma jornada cheia de aprendizados, desafios e TAILWINDCSS_IS_MOBILE_FIRST, TAILWINDCSS_A_POWERFUL_TOOL, GENERIC_COMPONENTS, + GENERIC_COMPONENTS_02, }); }