style(blog): add section dividers + drop redundant presenter comment
Code-quality reviewer flagged stylistic divergence from auth's pattern: - All 3 blog use cases now have // ── Input ──... / ── Output ──... / ── Use case ──... section dividers (consistent with auth Task 3 + plan template §4.1). - Removed inline comment in get-articles controller's presenter that appeared in only 1 of 3 controllers; identity presenters are self-explanatory.
This commit is contained in:
@@ -3,6 +3,7 @@ import { z } from "zod";
|
||||
import { articleSchema } from "../../entities/models/article";
|
||||
import type { IArticlesRepository } from "../repositories/articles.repository.interface";
|
||||
|
||||
// ── Input ────────────────────────────────────────────────────────────────
|
||||
export const createArticleInputSchema = z
|
||||
.object({
|
||||
title: z.string().min(1).max(255),
|
||||
@@ -13,9 +14,11 @@ export const createArticleInputSchema = z
|
||||
.strict();
|
||||
export type CreateArticleInput = z.infer<typeof createArticleInputSchema>;
|
||||
|
||||
// ── Output ───────────────────────────────────────────────────────────────
|
||||
export const createArticleOutputSchema = articleSchema;
|
||||
export type CreateArticleOutput = z.infer<typeof createArticleOutputSchema>;
|
||||
|
||||
// ── Use case ─────────────────────────────────────────────────────────────
|
||||
function generateSlug(title: string): string {
|
||||
return title
|
||||
.toLowerCase()
|
||||
|
||||
@@ -4,14 +4,17 @@ import { ArticleNotFoundError } from "../../entities/errors/article";
|
||||
import { articleSchema } from "../../entities/models/article";
|
||||
import type { IArticlesRepository } from "../repositories/articles.repository.interface";
|
||||
|
||||
// ── Input ────────────────────────────────────────────────────────────────
|
||||
export const getArticleBySlugInputSchema = z
|
||||
.object({ slug: z.string().min(1) })
|
||||
.strict();
|
||||
export type GetArticleBySlugInput = z.infer<typeof getArticleBySlugInputSchema>;
|
||||
|
||||
// ── Output ───────────────────────────────────────────────────────────────
|
||||
export const getArticleBySlugOutputSchema = articleSchema;
|
||||
export type GetArticleBySlugOutput = z.infer<typeof getArticleBySlugOutputSchema>;
|
||||
|
||||
// ── Use case ─────────────────────────────────────────────────────────────
|
||||
export type IGetArticleBySlugUseCase = ReturnType<typeof getArticleBySlugUseCase>;
|
||||
|
||||
export const getArticleBySlugUseCase =
|
||||
|
||||
@@ -3,6 +3,7 @@ import { z } from "zod";
|
||||
import { articleSchema, articleStatusSchema } from "../../entities/models/article";
|
||||
import type { IArticlesRepository } from "../repositories/articles.repository.interface";
|
||||
|
||||
// ── Input ────────────────────────────────────────────────────────────────
|
||||
export const getArticlesInputSchema = z
|
||||
.object({
|
||||
status: articleStatusSchema.optional(),
|
||||
@@ -13,9 +14,11 @@ export const getArticlesInputSchema = z
|
||||
.strict();
|
||||
export type GetArticlesInput = z.infer<typeof getArticlesInputSchema>;
|
||||
|
||||
// ── Output ───────────────────────────────────────────────────────────────
|
||||
export const getArticlesOutputSchema = z.array(articleSchema);
|
||||
export type GetArticlesOutput = z.infer<typeof getArticlesOutputSchema>;
|
||||
|
||||
// ── Use case ─────────────────────────────────────────────────────────────
|
||||
export type IGetArticlesUseCase = ReturnType<typeof getArticlesUseCase>;
|
||||
|
||||
export const getArticlesUseCase =
|
||||
|
||||
@@ -6,7 +6,6 @@ import {
|
||||
} from "../../application/use-cases/get-articles.use-case";
|
||||
|
||||
function presenter(value: GetArticlesOutput) {
|
||||
// identity for now (R11 — every non-void controller has a presenter)
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user