mirror of
https://github.com/samiyev/puaros.git
synced 2025-12-28 07:16:53 +05:00
docs: add framework leak examples
- Add UserWithFrameworks.ts example showing framework leaks in domain - Add examples/bad/ directory with anti-pattern demonstrations - Demonstrate common mistakes: Prisma in domain, Express types, etc.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* BAD EXAMPLE: Framework Leaks in Domain Layer
|
||||
* This file should be in a domain layer structure to be detected
|
||||
*/
|
||||
|
||||
import { PrismaClient } from "@prisma/client"
|
||||
import { Request, Response } from "express"
|
||||
import axios from "axios"
|
||||
|
||||
export class UserWithFrameworkLeaks {
|
||||
private prisma = new PrismaClient()
|
||||
|
||||
async save(): Promise<void> {
|
||||
await this.prisma.user.create({
|
||||
data: { id: "1", email: "test@example.com" },
|
||||
})
|
||||
}
|
||||
|
||||
async validateEmail(email: string): Promise<boolean> {
|
||||
const response = await axios.post("https://api.validator.com/email", { email })
|
||||
return response.data.valid
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user