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 { articleSchema } from "../../entities/models/article";
|
||||||
import type { IArticlesRepository } from "../repositories/articles.repository.interface";
|
import type { IArticlesRepository } from "../repositories/articles.repository.interface";
|
||||||
|
|
||||||
|
// ── Input ────────────────────────────────────────────────────────────────
|
||||||
export const createArticleInputSchema = z
|
export const createArticleInputSchema = z
|
||||||
.object({
|
.object({
|
||||||
title: z.string().min(1).max(255),
|
title: z.string().min(1).max(255),
|
||||||
@@ -13,9 +14,11 @@ export const createArticleInputSchema = z
|
|||||||
.strict();
|
.strict();
|
||||||
export type CreateArticleInput = z.infer<typeof createArticleInputSchema>;
|
export type CreateArticleInput = z.infer<typeof createArticleInputSchema>;
|
||||||
|
|
||||||
|
// ── Output ───────────────────────────────────────────────────────────────
|
||||||
export const createArticleOutputSchema = articleSchema;
|
export const createArticleOutputSchema = articleSchema;
|
||||||
export type CreateArticleOutput = z.infer<typeof createArticleOutputSchema>;
|
export type CreateArticleOutput = z.infer<typeof createArticleOutputSchema>;
|
||||||
|
|
||||||
|
// ── Use case ─────────────────────────────────────────────────────────────
|
||||||
function generateSlug(title: string): string {
|
function generateSlug(title: string): string {
|
||||||
return title
|
return title
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
|
|||||||
@@ -4,14 +4,17 @@ import { ArticleNotFoundError } from "../../entities/errors/article";
|
|||||||
import { articleSchema } from "../../entities/models/article";
|
import { articleSchema } from "../../entities/models/article";
|
||||||
import type { IArticlesRepository } from "../repositories/articles.repository.interface";
|
import type { IArticlesRepository } from "../repositories/articles.repository.interface";
|
||||||
|
|
||||||
|
// ── Input ────────────────────────────────────────────────────────────────
|
||||||
export const getArticleBySlugInputSchema = z
|
export const getArticleBySlugInputSchema = z
|
||||||
.object({ slug: z.string().min(1) })
|
.object({ slug: z.string().min(1) })
|
||||||
.strict();
|
.strict();
|
||||||
export type GetArticleBySlugInput = z.infer<typeof getArticleBySlugInputSchema>;
|
export type GetArticleBySlugInput = z.infer<typeof getArticleBySlugInputSchema>;
|
||||||
|
|
||||||
|
// ── Output ───────────────────────────────────────────────────────────────
|
||||||
export const getArticleBySlugOutputSchema = articleSchema;
|
export const getArticleBySlugOutputSchema = articleSchema;
|
||||||
export type GetArticleBySlugOutput = z.infer<typeof getArticleBySlugOutputSchema>;
|
export type GetArticleBySlugOutput = z.infer<typeof getArticleBySlugOutputSchema>;
|
||||||
|
|
||||||
|
// ── Use case ─────────────────────────────────────────────────────────────
|
||||||
export type IGetArticleBySlugUseCase = ReturnType<typeof getArticleBySlugUseCase>;
|
export type IGetArticleBySlugUseCase = ReturnType<typeof getArticleBySlugUseCase>;
|
||||||
|
|
||||||
export const getArticleBySlugUseCase =
|
export const getArticleBySlugUseCase =
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { z } from "zod";
|
|||||||
import { articleSchema, articleStatusSchema } from "../../entities/models/article";
|
import { articleSchema, articleStatusSchema } from "../../entities/models/article";
|
||||||
import type { IArticlesRepository } from "../repositories/articles.repository.interface";
|
import type { IArticlesRepository } from "../repositories/articles.repository.interface";
|
||||||
|
|
||||||
|
// ── Input ────────────────────────────────────────────────────────────────
|
||||||
export const getArticlesInputSchema = z
|
export const getArticlesInputSchema = z
|
||||||
.object({
|
.object({
|
||||||
status: articleStatusSchema.optional(),
|
status: articleStatusSchema.optional(),
|
||||||
@@ -13,9 +14,11 @@ export const getArticlesInputSchema = z
|
|||||||
.strict();
|
.strict();
|
||||||
export type GetArticlesInput = z.infer<typeof getArticlesInputSchema>;
|
export type GetArticlesInput = z.infer<typeof getArticlesInputSchema>;
|
||||||
|
|
||||||
|
// ── Output ───────────────────────────────────────────────────────────────
|
||||||
export const getArticlesOutputSchema = z.array(articleSchema);
|
export const getArticlesOutputSchema = z.array(articleSchema);
|
||||||
export type GetArticlesOutput = z.infer<typeof getArticlesOutputSchema>;
|
export type GetArticlesOutput = z.infer<typeof getArticlesOutputSchema>;
|
||||||
|
|
||||||
|
// ── Use case ─────────────────────────────────────────────────────────────
|
||||||
export type IGetArticlesUseCase = ReturnType<typeof getArticlesUseCase>;
|
export type IGetArticlesUseCase = ReturnType<typeof getArticlesUseCase>;
|
||||||
|
|
||||||
export const getArticlesUseCase =
|
export const getArticlesUseCase =
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import {
|
|||||||
} from "../../application/use-cases/get-articles.use-case";
|
} from "../../application/use-cases/get-articles.use-case";
|
||||||
|
|
||||||
function presenter(value: GetArticlesOutput) {
|
function presenter(value: GetArticlesOutput) {
|
||||||
// identity for now (R11 — every non-void controller has a presenter)
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user