Review code for MX Space project conventions. Checks NestJS patterns, TypeGoose models, Zod schemas, API design, etc.
Review code for project conventions. Target: $ARGUMENTS
@ApiController() instead of @Controller()PaginationResult<T> from repository (no special decorator needed)@Auth() decorator@Body/@Query/@Param({ schema }) with Zod schemasprivate readonly postRepository: PostRepository)ModuleRef and injection tokensscheduleManager.schedule()eventManager.emit() or eventManager.broadcast()BaseRepository from ~/processors/database/base.repository@Inject(PG_DB_TOKEN) db: AppDatabase constructor parameterthis.db.select().from(table).where(...))parseEntityId() / toEntityId() / toDbId()this.paginationOf(total, page, size) helper from BaseRepositoryPaginationResult<T> for paginated queries@Body/@Query/@Param({ schema }) (no createZodDto / nestjs-zod)zEntityId, zNonEmptyString, zCoerceInt)pgTable() in ~/database/schema/pkText() helper (Snowflake text IDs)refText() helpercreatedAt(), updatedAt(), or tsCol() helperspgTable()data and paginationBusinessExceptionPOST_SERVICE_TOKEN)@Global()createE2EApp to create test apppourData@Auth()Promise.allOffsetDto with before/after)attachCategory, attachRelated)// Wrong
import { IsString } from 'class-validator'
class CreateDto {
@IsString()
name: string
}
// Also wrong — nestjs-zod is removed
import { createZodDto } from 'nestjs-zod'
class CreateDto extends createZodDto(Schema) {}
// Correct
import { z } from 'zod'
export const Schema = z.object({ name: z.string() })
export type CreateInput = z.infer<typeof Schema>
// @Body({ schema: Schema }) body: CreateInput
// Wrong - manually wrapping array
return { data: items }
// Correct - ResponseInterceptor auto-wraps
return items
// Wrong - direct injection causes circular dependency
constructor(private readonly otherService: OtherService) {}
// Correct - use ModuleRef for lazy loading
private otherService: OtherService
constructor(private readonly moduleRef: ModuleRef) {}
onApplicationBootstrap() {
this.otherService = this.moduleRef.get(OTHER_SERVICE_TOKEN, { strict: false })
}
// Wrong - raw string param with no validation
@Get('/:id')
async get(@Param('id') id: string) {}
// Correct - validated entity ID
@Get('/:id')
async get(@Param({ schema: EntityIdSchema }) params: EntityIdDto) {
return this.service.findById(params.id)
}
// Wrong - passing raw string to DB query
await this.db.select().from(posts).where(eq(posts.id, id))
// Correct - validate ID at repository boundary
const idBig = parseEntityId(id)
await this.db.select().from(posts).where(eq(posts.id, idBig))
After review, output in the following format:
## Review Results
### Passed
- [x] Item 1
- [x] Item 2
### Needs Changes
- [ ] Issue description
- Location: `file:line`
- Suggestion: Change recommendation
### Optimization Suggestions
- Suggestion 1
- Suggestion 2