@autobe/agent 0.28.0 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/AutoBeAgent.js +1 -0
- package/lib/AutoBeAgent.js.map +1 -1
- package/lib/AutoBeMockAgent.js +1 -0
- package/lib/AutoBeMockAgent.js.map +1 -1
- package/lib/constants/AutoBeConfigConstant.d.ts +3 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +39 -26
- package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
- package/lib/context/AutoBeContext.d.ts +1 -1
- package/lib/factory/createAutoBeContext.js +5 -3
- package/lib/factory/createAutoBeContext.js.map +1 -1
- package/lib/index.mjs +37005 -17000
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.d.ts +7 -2
- package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js +11 -21
- package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.d.ts +2 -2
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +12 -5
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.d.ts +2 -2
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +53 -50
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyze.js +2 -2
- package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeReview.js +855 -258
- package/lib/orchestrate/analyze/orchestrateAnalyzeReview.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js +15 -22
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js +2 -9
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.d.ts +110 -36
- package/lib/orchestrate/common/AutoBePreliminaryController.d.ts +40 -0
- package/lib/orchestrate/common/AutoBePreliminaryController.js +97 -0
- package/lib/orchestrate/common/AutoBePreliminaryController.js.map +1 -0
- package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistory.d.ts +8 -0
- package/lib/orchestrate/{realize/histories/transformRealizeCorrectCastingHistories.js → common/histories/transformCommonCorrectCastingHistory.js} +16 -13
- package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistory.js.map +1 -0
- package/lib/orchestrate/common/histories/transformPreliminaryHistory.d.ts +4 -0
- package/lib/orchestrate/common/histories/transformPreliminaryHistory.js +285 -0
- package/lib/orchestrate/common/histories/transformPreliminaryHistory.js.map +1 -0
- package/lib/orchestrate/common/histories/{transformPreviousAndLatestCorrectHistories.d.ts → transformPreviousAndLatestCorrectHistory.d.ts} +1 -1
- package/lib/orchestrate/common/histories/{transformPreviousAndLatestCorrectHistories.js → transformPreviousAndLatestCorrectHistory.js} +4 -4
- package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistory.js.map +1 -0
- package/lib/orchestrate/common/internal/complementPreliminaryCollection.d.ts +7 -0
- package/lib/orchestrate/common/internal/complementPreliminaryCollection.js +99 -0
- package/lib/orchestrate/common/internal/complementPreliminaryCollection.js.map +1 -0
- package/lib/orchestrate/common/internal/createPreliminaryCollection.d.ts +3 -0
- package/lib/orchestrate/common/internal/createPreliminaryCollection.js +20 -0
- package/lib/orchestrate/common/internal/createPreliminaryCollection.js.map +1 -0
- package/lib/orchestrate/common/internal/validatePreliminary.d.ts +5 -0
- package/lib/orchestrate/common/internal/validatePreliminary.js +217 -0
- package/lib/orchestrate/common/internal/validatePreliminary.js.map +1 -0
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js +10 -22
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js.map +1 -1
- package/lib/orchestrate/common/orchestratePreliminary.d.ts +12 -0
- package/lib/orchestrate/common/orchestratePreliminary.js +231 -0
- package/lib/orchestrate/common/orchestratePreliminary.js.map +1 -0
- package/lib/orchestrate/common/structures/AutoBePreliminaryRequest.d.ts +16 -0
- package/lib/orchestrate/{realize/structures/IAutoBeRealizeAuthorizationApplication.js → common/structures/AutoBePreliminaryRequest.js} +1 -1
- package/lib/orchestrate/common/structures/AutoBePreliminaryRequest.js.map +1 -0
- package/lib/orchestrate/common/structures/IAutoBeCommonCorrectCastingApplication.d.ts +1 -4
- package/lib/orchestrate/common/structures/IAutoBeOrchestrateResult.d.ts +9 -0
- package/lib/orchestrate/{interface/structures/IAutoBeInterfacePrerequisitesApplication.js → common/structures/IAutoBeOrchestrateResult.js} +1 -1
- package/lib/orchestrate/common/structures/IAutoBeOrchestrateResult.js.map +1 -0
- package/lib/orchestrate/common/structures/IAutoBePreliminaryCollection.d.ts +8 -0
- package/lib/orchestrate/{interface/structures/IAutoBeInterfaceEndpointsReviewApplication.js → common/structures/IAutoBePreliminaryCollection.js} +1 -1
- package/lib/orchestrate/common/structures/IAutoBePreliminaryCollection.js.map +1 -0
- package/lib/orchestrate/common/structures/IAutoBePreliminaryGetAnalysisFiles.d.ts +27 -0
- package/lib/orchestrate/{interface/structures/IAutoBeInterfaceOperationsReviewApplication.js → common/structures/IAutoBePreliminaryGetAnalysisFiles.js} +1 -1
- package/lib/orchestrate/common/structures/IAutoBePreliminaryGetAnalysisFiles.js.map +1 -0
- package/lib/orchestrate/common/structures/IAutoBePreliminaryGetInterfaceOperations.d.ts +28 -0
- package/lib/orchestrate/common/structures/IAutoBePreliminaryGetInterfaceOperations.js +3 -0
- package/lib/orchestrate/common/structures/IAutoBePreliminaryGetInterfaceOperations.js.map +1 -0
- package/lib/orchestrate/common/structures/IAutoBePreliminaryGetInterfaceSchemas.d.ts +27 -0
- package/lib/orchestrate/common/structures/IAutoBePreliminaryGetInterfaceSchemas.js +3 -0
- package/lib/orchestrate/common/structures/IAutoBePreliminaryGetInterfaceSchemas.js.map +1 -0
- package/lib/orchestrate/common/structures/IAutoBePreliminaryGetPrismaSchemas.d.ts +27 -0
- package/lib/orchestrate/common/structures/IAutoBePreliminaryGetPrismaSchemas.js +3 -0
- package/lib/orchestrate/common/structures/IAutoBePreliminaryGetPrismaSchemas.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationHistory.d.ts +10 -0
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationHistory.js +70 -0
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationHistory.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceCommonHistory.d.ts +3 -0
- package/lib/orchestrate/interface/histories/{transformInterfaceCommonHistories.js → transformInterfaceCommonHistory.js} +4 -4
- package/lib/orchestrate/interface/histories/transformInterfaceCommonHistory.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistory.d.ts +9 -0
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistory.js +60 -0
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistory.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistory.d.ts +12 -0
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistory.js +63 -0
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistory.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointReviewHistory.d.ts +7 -0
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointReviewHistory.js +36 -0
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointReviewHistory.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistory.d.ts +6 -0
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistory.js +68 -0
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistory.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistory.d.ts +9 -0
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistory.js +72 -0
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistory.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceOperationReviewHistory.d.ts +7 -0
- package/lib/orchestrate/interface/histories/transformInterfaceOperationReviewHistory.js +38 -0
- package/lib/orchestrate/interface/histories/transformInterfaceOperationReviewHistory.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisiteHistory.d.ts +8 -0
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisiteHistory.js +73 -0
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisiteHistory.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistory.d.ts +11 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistory.js +95 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistory.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistory.d.ts +5 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistory.js +54 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistory.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistory.d.ts +12 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistory.js +75 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistory.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterface.js +90 -46
- package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorization.d.ts +6 -0
- package/lib/orchestrate/interface/{orchestrateInterfaceAuthorizations.js → orchestrateInterfaceAuthorization.js} +1395 -241
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorization.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.d.ts +4 -3
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +2843 -556
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
- package/lib/orchestrate/interface/{orchestrateInterfaceEndpoints.d.ts → orchestrateInterfaceEndpoint.d.ts} +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoint.js +1356 -0
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoint.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointReview.d.ts +4 -0
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointReview.js +1337 -0
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointReview.js.map +1 -0
- package/lib/orchestrate/interface/{orchestrateInterfaceGroups.d.ts → orchestrateInterfaceGroup.d.ts} +1 -2
- package/lib/orchestrate/interface/orchestrateInterfaceGroup.js +621 -0
- package/lib/orchestrate/interface/orchestrateInterfaceGroup.js.map +1 -0
- package/lib/orchestrate/interface/{orchestrateInterfaceOperations.d.ts → orchestrateInterfaceOperation.d.ts} +1 -2
- package/lib/orchestrate/interface/{orchestrateInterfaceOperations.js → orchestrateInterfaceOperation.js} +1299 -232
- package/lib/orchestrate/interface/orchestrateInterfaceOperation.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterfaceOperationReview.d.ts +4 -0
- package/lib/orchestrate/interface/{orchestrateInterfaceOperationsReview.js → orchestrateInterfaceOperationReview.js} +1447 -264
- package/lib/orchestrate/interface/orchestrateInterfaceOperationReview.js.map +1 -0
- package/lib/orchestrate/interface/{orchestrateInterfacePrerequisites.d.ts → orchestrateInterfacePrerequisite.d.ts} +1 -1
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisite.js +2159 -0
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisite.js.map +1 -0
- package/lib/orchestrate/interface/{orchestrateInterfaceSchemas.d.ts → orchestrateInterfaceSchema.d.ts} +1 -2
- package/lib/orchestrate/interface/{orchestrateInterfaceSchemas.js → orchestrateInterfaceSchema.js} +2586 -570
- package/lib/orchestrate/interface/orchestrateInterfaceSchema.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js +7 -17
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.d.ts +1 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.js +2875 -588
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.js.map +1 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceAuthorizationsApplication.d.ts +56 -5
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.d.ts +57 -10
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceEndpointApplication.d.ts +55 -10
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceEndpointReviewApplication.d.ts +96 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceEndpointReviewApplication.js +3 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceEndpointReviewApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.d.ts +6 -82
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +58 -13
- package/lib/orchestrate/interface/structures/{IAutoBeInterfaceOperationsReviewApplication.d.ts → IAutoBeInterfaceOperationReviewApplication.d.ts} +58 -28
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationReviewApplication.js +3 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationReviewApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfacePrerequisiteApplication.d.ts +98 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfacePrerequisiteApplication.js +3 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfacePrerequisiteApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.d.ts +56 -15
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.d.ts +62 -22
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.d.ts +60 -21
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.d.ts +61 -19
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.js +29 -23
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.js.map +1 -1
- package/lib/orchestrate/interface/utils/JsonSchemaNamingConvention.js +67 -61
- package/lib/orchestrate/interface/utils/JsonSchemaNamingConvention.js.map +1 -1
- package/lib/orchestrate/interface/utils/JsonSchemaValidator.d.ts +2 -1
- package/lib/orchestrate/interface/utils/JsonSchemaValidator.js +52 -25
- package/lib/orchestrate/interface/utils/JsonSchemaValidator.js.map +1 -1
- package/lib/orchestrate/interface/utils/OperationValidator.js +59 -1
- package/lib/orchestrate/interface/utils/OperationValidator.js.map +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistory.d.ts +6 -0
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistory.js +98 -0
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistory.js.map +1 -0
- package/lib/orchestrate/prisma/histories/transformPrismaCorrectHistory.d.ts +7 -0
- package/lib/orchestrate/prisma/histories/transformPrismaCorrectHistory.js +31 -0
- package/lib/orchestrate/prisma/histories/transformPrismaCorrectHistory.js.map +1 -0
- package/lib/orchestrate/prisma/histories/transformPrismaReviewHistory.d.ts +7 -0
- package/lib/orchestrate/prisma/histories/transformPrismaReviewHistory.js +38 -0
- package/lib/orchestrate/prisma/histories/transformPrismaReviewHistory.js.map +1 -0
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistory.d.ts +8 -0
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistory.js +79 -0
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistory.js.map +1 -0
- package/lib/orchestrate/prisma/orchestratePrisma.js +9 -6
- package/lib/orchestrate/prisma/orchestratePrisma.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.d.ts +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js +19 -22
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +2864 -1535
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaReview.d.ts +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaReview.js +2886 -1557
- package/lib/orchestrate/prisma/orchestratePrismaReview.js.map +1 -1
- package/lib/orchestrate/prisma/{orchestratePrismaSchemas.d.ts → orchestratePrismaSchema.d.ts} +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchema.js +3068 -0
- package/lib/orchestrate/prisma/orchestratePrismaSchema.js.map +1 -0
- package/lib/orchestrate/prisma/structures/IAutoBePrismaCorrectApplication.d.ts +74 -76
- package/lib/orchestrate/prisma/structures/IAutoBePrismaReviewApplication.d.ts +90 -72
- package/lib/orchestrate/prisma/structures/IAutoBePrismaSchemaApplication.d.ts +89 -66
- package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistory.d.ts +9 -0
- package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistory.js +79 -0
- package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistory.js.map +1 -0
- package/lib/orchestrate/realize/histories/transformRealizeAuthorizationWriteHistory.d.ts +7 -0
- package/lib/orchestrate/realize/histories/transformRealizeAuthorizationWriteHistory.js +41 -0
- package/lib/orchestrate/realize/histories/transformRealizeAuthorizationWriteHistory.js.map +1 -0
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistory.d.ts +12 -0
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistory.js +67 -0
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistory.js.map +1 -0
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistory.d.ts +18 -0
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistory.js +54 -0
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistory.js.map +1 -0
- package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.d.ts +4 -2
- package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js +140 -106
- package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteMembershipHistory.d.ts +3 -0
- package/lib/orchestrate/realize/histories/transformRealizeWriteMembershipHistory.js +23 -0
- package/lib/orchestrate/realize/histories/transformRealizeWriteMembershipHistory.js.map +1 -0
- package/lib/orchestrate/realize/orchestrateRealize.js +4 -4
- package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.d.ts +5 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +1288 -569
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
- package/lib/orchestrate/realize/{orchestrateRealizeAuthorization.d.ts → orchestrateRealizeAuthorizationWrite.d.ts} +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationWrite.js +1410 -0
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationWrite.js.map +1 -0
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js +664 -140
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeCorrectCasting.js +20 -65
- package/lib/orchestrate/realize/orchestrateRealizeCorrectCasting.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeWrite.js +660 -135
- package/lib/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.d.ts +79 -19
- package/lib/orchestrate/realize/structures/{IAutoBeRealizeAuthorizationApplication.d.ts → IAutoBeRealizeAuthorizationWriteApplication.d.ts} +60 -27
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationWriteApplication.js +3 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationWriteApplication.js.map +1 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.d.ts +54 -5
- package/lib/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.d.ts +6 -14
- package/lib/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +54 -6
- package/lib/orchestrate/realize/utils/generateRealizeScenario.d.ts +1 -3
- package/lib/orchestrate/realize/utils/generateRealizeScenario.js +1 -7
- package/lib/orchestrate/realize/utils/generateRealizeScenario.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.d.ts +3 -3
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.js +23 -20
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistory.d.ts +4 -0
- package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistory.js +36 -0
- package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistory.js.map +1 -0
- package/lib/orchestrate/test/histories/transformTestScenarioHistory.d.ts +11 -0
- package/lib/orchestrate/test/histories/transformTestScenarioHistory.js +95 -0
- package/lib/orchestrate/test/histories/transformTestScenarioHistory.js.map +1 -0
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistory.d.ts +10 -0
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistory.js +67 -0
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistory.js.map +1 -0
- package/lib/orchestrate/test/histories/{transformTestWriteHistories.d.ts → transformTestWriteHistory.d.ts} +4 -4
- package/lib/orchestrate/test/histories/{transformTestWriteHistories.js → transformTestWriteHistory.js} +79 -76
- package/lib/orchestrate/test/histories/transformTestWriteHistory.js.map +1 -0
- package/lib/orchestrate/test/orchestrateTestCorrect.js +13 -26
- package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js +3 -15
- package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.d.ts +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.js +1381 -325
- package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenarioReview.d.ts +5 -3
- package/lib/orchestrate/test/orchestrateTestScenarioReview.js +1072 -291
- package/lib/orchestrate/test/orchestrateTestScenarioReview.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestWrite.js +8 -15
- package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +66 -4
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioReviewApplication.d.ts +82 -14
- package/lib/structures/IAutoBeOrchestrateHistory.d.ts +5 -0
- package/lib/structures/IAutoBeOrchestrateHistory.js +3 -0
- package/lib/structures/IAutoBeOrchestrateHistory.js.map +1 -0
- package/lib/utils/executeCachedBatch.d.ts +5 -1
- package/lib/utils/executeCachedBatch.js +23 -5
- package/lib/utils/executeCachedBatch.js.map +1 -1
- package/lib/utils/validateEmptyCode.js +2 -2
- package/lib/utils/validateEmptyCode.js.map +1 -1
- package/package.json +10 -8
- package/src/AutoBeAgent.ts +1 -0
- package/src/AutoBeMockAgent.ts +1 -0
- package/src/constants/AutoBeConfigConstant.ts +2 -0
- package/src/constants/AutoBeSystemPromptConstant.ts +39 -26
- package/src/context/AutoBeContext.ts +1 -1
- package/src/factory/createAutoBeContext.ts +5 -2
- package/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.ts +17 -28
- package/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.ts +12 -6
- package/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.ts +62 -61
- package/src/orchestrate/analyze/orchestrateAnalyze.ts +2 -0
- package/src/orchestrate/analyze/orchestrateAnalyzeReview.ts +97 -48
- package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +3 -16
- package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +1 -2
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.ts +114 -36
- package/src/orchestrate/common/AutoBePreliminaryController.ts +161 -0
- package/src/orchestrate/common/histories/transformCommonCorrectCastingHistory.ts +32 -0
- package/src/orchestrate/common/histories/transformPreliminaryHistory.ts +383 -0
- package/src/orchestrate/common/histories/{transformPreviousAndLatestCorrectHistories.ts → transformPreviousAndLatestCorrectHistory.ts} +1 -1
- package/src/orchestrate/common/internal/complementPreliminaryCollection.ts +123 -0
- package/src/orchestrate/common/internal/createPreliminaryCollection.ts +32 -0
- package/src/orchestrate/common/internal/validatePreliminary.ts +315 -0
- package/src/orchestrate/common/orchestrateCommonCorrectCasting.ts +8 -15
- package/src/orchestrate/common/orchestratePreliminary.ts +361 -0
- package/src/orchestrate/common/structures/AutoBePreliminaryRequest.ts +18 -0
- package/src/orchestrate/common/structures/IAutoBeCommonCorrectCastingApplication.ts +1 -4
- package/src/orchestrate/common/structures/IAutoBeOrchestrateResult.ts +13 -0
- package/src/orchestrate/common/structures/IAutoBePreliminaryCollection.ts +9 -0
- package/src/orchestrate/common/structures/IAutoBePreliminaryGetAnalysisFiles.ts +29 -0
- package/src/orchestrate/common/structures/IAutoBePreliminaryGetInterfaceOperations.ts +30 -0
- package/src/orchestrate/common/structures/IAutoBePreliminaryGetInterfaceSchemas.ts +29 -0
- package/src/orchestrate/common/structures/IAutoBePreliminaryGetPrismaSchemas.ts +29 -0
- package/src/orchestrate/interface/histories/transformInterfaceAuthorizationHistory.ts +77 -0
- package/src/orchestrate/interface/histories/{transformInterfaceCommonHistories.ts → transformInterfaceCommonHistory.ts} +1 -1
- package/src/orchestrate/interface/histories/{transformInterfaceGroupHistories.ts → transformInterfaceComplementHistory.ts} +35 -21
- package/src/orchestrate/interface/histories/transformInterfaceEndpointHistory.ts +74 -0
- package/src/orchestrate/interface/histories/transformInterfaceEndpointReviewHistory.ts +40 -0
- package/src/orchestrate/interface/histories/transformInterfaceGroupHistory.ts +72 -0
- package/src/orchestrate/interface/histories/transformInterfaceOperationHistory.ts +79 -0
- package/src/orchestrate/interface/histories/transformInterfaceOperationReviewHistory.ts +43 -0
- package/src/orchestrate/interface/histories/transformInterfacePrerequisiteHistory.ts +89 -0
- package/src/orchestrate/interface/histories/transformInterfaceSchemaHistory.ts +105 -0
- package/src/orchestrate/interface/histories/transformInterfaceSchemaRenameHistory.ts +56 -0
- package/src/orchestrate/interface/histories/transformInterfaceSchemaReviewHistory.ts +88 -0
- package/src/orchestrate/interface/orchestrateInterface.ts +115 -51
- package/src/orchestrate/interface/{orchestrateInterfaceAuthorizations.ts → orchestrateInterfaceAuthorization.ts} +91 -67
- package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +174 -78
- package/src/orchestrate/interface/orchestrateInterfaceEndpoint.ts +207 -0
- package/src/orchestrate/interface/orchestrateInterfaceEndpointReview.ts +139 -0
- package/src/orchestrate/interface/orchestrateInterfaceGroup.ts +153 -0
- package/src/orchestrate/interface/{orchestrateInterfaceOperations.ts → orchestrateInterfaceOperation.ts} +109 -86
- package/src/orchestrate/interface/orchestrateInterfaceOperationReview.ts +186 -0
- package/src/orchestrate/interface/{orchestrateInterfacePrerequisites.ts → orchestrateInterfacePrerequisite.ts} +123 -58
- package/src/orchestrate/interface/{orchestrateInterfaceSchemas.ts → orchestrateInterfaceSchema.ts} +96 -90
- package/src/orchestrate/interface/orchestrateInterfaceSchemaRename.ts +10 -11
- package/src/orchestrate/interface/orchestrateInterfaceSchemaReview.ts +127 -60
- package/src/orchestrate/interface/structures/IAutoBeInterfaceAuthorizationsApplication.ts +63 -5
- package/src/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.ts +67 -12
- package/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointApplication.ts +63 -10
- package/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointReviewApplication.ts +106 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.ts +6 -84
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +65 -13
- package/src/orchestrate/interface/structures/{IAutoBeInterfaceOperationsReviewApplication.ts → IAutoBeInterfaceOperationReviewApplication.ts} +65 -30
- package/src/orchestrate/interface/structures/IAutoBeInterfacePrerequisiteApplication.ts +111 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.ts +65 -15
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.ts +71 -24
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.ts +68 -23
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.ts +69 -21
- package/src/orchestrate/interface/utils/JsonSchemaFactory.ts +31 -23
- package/src/orchestrate/interface/utils/JsonSchemaNamingConvention.ts +73 -61
- package/src/orchestrate/interface/utils/JsonSchemaValidator.ts +53 -26
- package/src/orchestrate/interface/utils/OperationValidator.ts +69 -1
- package/src/orchestrate/prisma/histories/transformPrismaComponentsHistory.ts +109 -0
- package/src/orchestrate/prisma/histories/{transformPrismaCorrectHistories.ts → transformPrismaCorrectHistory.ts} +13 -22
- package/src/orchestrate/prisma/histories/transformPrismaReviewHistory.ts +42 -0
- package/src/orchestrate/prisma/histories/{transformPrismaSchemaHistories.ts → transformPrismaSchemaHistory.ts} +7 -8
- package/src/orchestrate/prisma/orchestratePrisma.ts +12 -17
- package/src/orchestrate/prisma/orchestratePrismaComponent.ts +7 -15
- package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +129 -64
- package/src/orchestrate/prisma/orchestratePrismaReview.ts +115 -59
- package/src/orchestrate/prisma/{orchestratePrismaSchemas.ts → orchestratePrismaSchema.ts} +92 -60
- package/src/orchestrate/prisma/structures/IAutoBePrismaCorrectApplication.ts +81 -76
- package/src/orchestrate/prisma/structures/IAutoBePrismaReviewApplication.ts +97 -72
- package/src/orchestrate/prisma/structures/IAutoBePrismaSchemaApplication.ts +93 -66
- package/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistory.ts +89 -0
- package/src/orchestrate/realize/histories/transformRealizeAuthorizationWriteHistory.ts +45 -0
- package/src/orchestrate/realize/histories/transformRealizeCorrectCastingHistory.ts +85 -0
- package/src/orchestrate/realize/histories/transformRealizeCorrectHistory.ts +77 -0
- package/src/orchestrate/realize/histories/transformRealizeWriteHistories.ts +152 -121
- package/src/orchestrate/realize/histories/{transformRealizeWriteAuthorizationsHistories.ts → transformRealizeWriteMembershipHistory.ts} +2 -2
- package/src/orchestrate/realize/orchestrateRealize.ts +4 -3
- package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +155 -97
- package/src/orchestrate/realize/orchestrateRealizeAuthorizationWrite.ts +241 -0
- package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +88 -86
- package/src/orchestrate/realize/orchestrateRealizeCorrectCasting.ts +17 -56
- package/src/orchestrate/realize/orchestrateRealizeWrite.ts +82 -78
- package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.ts +85 -22
- package/src/orchestrate/realize/structures/{IAutoBeRealizeAuthorizationApplication.ts → IAutoBeRealizeAuthorizationWriteApplication.ts} +64 -29
- package/src/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.ts +58 -5
- package/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.ts +6 -19
- package/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.ts +58 -6
- package/src/orchestrate/realize/utils/generateRealizeScenario.ts +2 -20
- package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +30 -30
- package/src/orchestrate/test/histories/transformTestCorrectInvalidRequestHistory.ts +40 -0
- package/src/orchestrate/test/histories/transformTestScenarioHistory.ts +116 -0
- package/src/orchestrate/test/histories/transformTestScenarioReviewHistory.ts +85 -0
- package/src/orchestrate/test/histories/transformTestWriteHistory.ts +169 -0
- package/src/orchestrate/test/orchestrateTestCorrect.ts +13 -19
- package/src/orchestrate/test/orchestrateTestCorrectInvalidRequest.ts +5 -12
- package/src/orchestrate/test/orchestrateTestScenario.ts +143 -83
- package/src/orchestrate/test/orchestrateTestScenarioReview.ts +93 -76
- package/src/orchestrate/test/orchestrateTestWrite.ts +7 -7
- package/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.ts +74 -4
- package/src/orchestrate/test/structures/IAutoBeTestScenarioReviewApplication.ts +89 -14
- package/src/structures/IAutoBeOrchestrateHistory.ts +6 -0
- package/src/utils/executeCachedBatch.ts +33 -7
- package/src/utils/validateEmptyCode.ts +2 -2
- package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.d.ts +0 -8
- package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js +0 -16
- package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js.map +0 -1
- package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.js.map +0 -1
- package/lib/orchestrate/interface/histories/transformInterfaceAssetHistories.d.ts +0 -3
- package/lib/orchestrate/interface/histories/transformInterfaceAssetHistories.js +0 -62
- package/lib/orchestrate/interface/histories/transformInterfaceAssetHistories.js.map +0 -1
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.d.ts +0 -8
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +0 -68
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +0 -1
- package/lib/orchestrate/interface/histories/transformInterfaceCommonHistories.d.ts +0 -3
- package/lib/orchestrate/interface/histories/transformInterfaceCommonHistories.js.map +0 -1
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.d.ts +0 -9
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js +0 -74
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +0 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.d.ts +0 -10
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +0 -61
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +0 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.d.ts +0 -4
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +0 -34
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +0 -1
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.d.ts +0 -6
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js +0 -52
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +0 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.d.ts +0 -8
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js +0 -71
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +0 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.d.ts +0 -5
- package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +0 -36
- package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +0 -1
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.d.ts +0 -3
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.js +0 -102
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.js.map +0 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.d.ts +0 -9
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +0 -74
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +0 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.d.ts +0 -5
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.js +0 -51
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.js.map +0 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.d.ts +0 -11
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.js +0 -81
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.js.map +0 -1
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.d.ts +0 -4
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +0 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +0 -506
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +0 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.d.ts +0 -4
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.js +0 -487
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.js.map +0 -1
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js +0 -455
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js.map +0 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +0 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.d.ts +0 -4
- package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +0 -1
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js +0 -916
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js.map +0 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js.map +0 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.d.ts +0 -60
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.js.map +0 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.js.map +0 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfacePrerequisitesApplication.d.ts +0 -52
- package/lib/orchestrate/interface/structures/IAutoBeInterfacePrerequisitesApplication.js.map +0 -1
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.d.ts +0 -6
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +0 -95
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +0 -1
- package/lib/orchestrate/prisma/histories/transformPrismaCorrectHistories.d.ts +0 -3
- package/lib/orchestrate/prisma/histories/transformPrismaCorrectHistories.js +0 -41
- package/lib/orchestrate/prisma/histories/transformPrismaCorrectHistories.js.map +0 -1
- package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.d.ts +0 -8
- package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js +0 -62
- package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +0 -1
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.d.ts +0 -8
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +0 -78
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +0 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js +0 -1678
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js.map +0 -1
- package/lib/orchestrate/realize/histories/transformRealizeAuthorization.d.ts +0 -5
- package/lib/orchestrate/realize/histories/transformRealizeAuthorization.js +0 -44
- package/lib/orchestrate/realize/histories/transformRealizeAuthorization.js.map +0 -1
- package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.d.ts +0 -5
- package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js +0 -82
- package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js.map +0 -1
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.d.ts +0 -5
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js.map +0 -1
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +0 -13
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js +0 -29
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +0 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.d.ts +0 -3
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js +0 -23
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js.map +0 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js +0 -707
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js.map +0 -1
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.js.map +0 -1
- package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.d.ts +0 -4
- package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js +0 -33
- package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js.map +0 -1
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.d.ts +0 -10
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.js +0 -101
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.js.map +0 -1
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.d.ts +0 -8
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js +0 -72
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js.map +0 -1
- package/lib/orchestrate/test/histories/transformTestWriteHistories.js.map +0 -1
- package/src/orchestrate/common/histories/transformCommonCorrectCastingHistories.ts +0 -25
- package/src/orchestrate/interface/histories/transformInterfaceAssetHistories.ts +0 -72
- package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +0 -75
- package/src/orchestrate/interface/histories/transformInterfaceComplementHistories.ts +0 -82
- package/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.ts +0 -72
- package/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.ts +0 -40
- package/src/orchestrate/interface/histories/transformInterfaceOperationHistories.ts +0 -78
- package/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.ts +0 -44
- package/src/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.ts +0 -118
- package/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.ts +0 -80
- package/src/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.ts +0 -55
- package/src/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.ts +0 -90
- package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +0 -152
- package/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.ts +0 -98
- package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +0 -91
- package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +0 -157
- package/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.ts +0 -65
- package/src/orchestrate/interface/structures/IAutoBeInterfacePrerequisitesApplication.ts +0 -58
- package/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.ts +0 -104
- package/src/orchestrate/prisma/histories/transformPrismaReviewHistories.ts +0 -69
- package/src/orchestrate/realize/histories/transformRealizeAuthorization.ts +0 -52
- package/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.ts +0 -95
- package/src/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.ts +0 -30
- package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +0 -46
- package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +0 -185
- package/src/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.ts +0 -39
- package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +0 -125
- package/src/orchestrate/test/histories/transformTestScenarioReviewHistories.ts +0 -89
- package/src/orchestrate/test/histories/transformTestWriteHistories.ts +0 -172
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.transformInterfaceComplementHistories = void 0;
|
|
4
|
-
const utils_1 = require("@autobe/utils");
|
|
5
|
-
const uuid_1 = require("uuid");
|
|
6
|
-
const transformInterfaceAssetHistories_1 = require("./transformInterfaceAssetHistories");
|
|
7
|
-
const transformInterfaceComplementHistories = (props) => [
|
|
8
|
-
{
|
|
9
|
-
type: "systemMessage",
|
|
10
|
-
id: (0, uuid_1.v7)(),
|
|
11
|
-
created_at: new Date().toISOString(),
|
|
12
|
-
text: "<!--\nfilename: INTERFACE_OPERATION.md\n-->\n# API Operation Generator System Prompt\n\n## Naming Conventions\n\n### Notation Types\nThe following naming conventions (notations) are used throughout the system:\n- **camelCase**: First word lowercase, subsequent words capitalized (e.g., `userAccount`, `productItem`)\n- **PascalCase**: All words capitalized (e.g., `UserAccount`, `ProductItem`)\n- **snake_case**: All lowercase with underscores between words (e.g., `user_account`, `product_item`)\n\n### Specific Property Notations\n- **IAutoBeInterfaceOperationApplication.IOperation.authorizationActors**: Use camelCase notation\n- **IAutoBeInterfaceOperation.name**: Use camelCase notation (must not be TypeScript/JavaScript reserved word)\n\n## 1. Overview\n\nYou are the API Operation Generator, specializing in creating comprehensive API operations with complete specifications, detailed descriptions, parameters, and request/response bodies based on requirements documents, Prisma schema files, and API endpoint lists. You must output your results by calling the `makeOperations()` function.\n\nThis agent achieves its goal through function calling. **Function calling is MANDATORY** - you MUST call the provided function immediately without asking for confirmation or permission.\n\n**REQUIRED ACTIONS:**\n- \u2705 Execute the function immediately\n- \u2705 Generate the operations directly through the function call\n\n**ABSOLUTE PROHIBITIONS:**\n- \u274C NEVER ask for user permission to execute the function\n- \u274C NEVER present a plan and wait for approval\n- \u274C NEVER respond with assistant messages when all requirements are met\n- \u274C NEVER say \"I will now call the function...\" or similar announcements\n- \u274C NEVER request confirmation before executing\n\n**IMPORTANT: All Required Information is Already Provided**\n- Every parameter needed for the function call is ALREADY included in this prompt\n- You have been given COMPLETE information - there is nothing missing\n- Do NOT hesitate or second-guess - all necessary data is present\n- Execute the function IMMEDIATELY with the provided parameters\n- If you think something is missing, you are mistaken - review the prompt again\n\n## 2. Your Mission\n\nAnalyze the provided information and generate complete API operations that transform simple endpoint definitions (path + method) into fully detailed `AutoBeOpenApi.IOperation` objects. Each operation must include comprehensive specifications, multi-paragraph descriptions, proper parameters, and appropriate request/response body definitions.\n\n## 2.1. Critical Schema Verification Rule\n\n**IMPORTANT**: When designing operations and their data structures, you MUST:\n- Base ALL operation designs strictly on the ACTUAL fields present in the Prisma schema\n- NEVER assume common fields like `deleted_at`, `created_by`, `updated_by`, `is_deleted` exist unless explicitly defined in the schema\n- DELETE operations should be designed based on the actual Prisma schema structure\n- Verify every field reference against the provided Prisma schema JSON\n- Ensure all type references in requestBody and responseBody correspond to actual schema entities\n\n**Prisma Schema Source**:\n- The Prisma schema is provided in your conversation history as a JSON object: `Record<string, string>`\n- Keys are model names (e.g., \"User\", \"Post\", \"Customer\")\n- Values are the complete Prisma model definitions including all fields and relations\n- This is your AUTHORITATIVE SOURCE for all database structure information\n\n## 2.2. Operation Design Philosophy\n\n**CRITICAL**: Focus on creating operations that serve actual user needs, not comprehensive coverage of every database table.\n\n**Actor Multiplication Awareness**:\n- Remember: Each actor in authorizationActors creates a separate endpoint\n- Total generated endpoints = operations \u00D7 actors\n- Be intentional about which actors truly need separate endpoints\n\n**Design Principles**:\n- **User-Centric**: Create operations users actually need to perform\n- **Avoid Over-Engineering**: Not every table requires full CRUD operations\n- **System vs User Data**: Distinguish between what users manage vs what the system manages\n- **Business Logic Focus**: Operations should reflect business workflows, not database structure\n- **Beyond Tables**: Operations can transcend single table boundaries through SQL composition\n\n**Ask Before Creating Each Operation**:\n- Does a user actually perform this action?\n- Is this data user-managed or system-managed?\n- Will this operation ever be called from the UI/client?\n- Is this operation redundant with another operation?\n\n### 2.2.1. Operations Beyond Database Tables\n\n**CRITICAL INSIGHT**: Not all valuable operations map directly to single Prisma tables. Many essential business operations emerge from SQL composition, aggregation, and multi-table analysis.\n\n**The Requirements-First Principle**:\n- **PRIMARY SOURCE**: Analyze requirements deeply for implicit data needs\n- **SECONDARY SOURCE**: Map Prisma tables to support these needs\n- **DO NOT**: Limit operations to only what tables directly represent\n\n**Categories of Non-Table Operations**:\n\n**1. Statistical Aggregations** (GROUP BY, COUNT, SUM, AVG, percentiles):\n- **Business Need**: \"Show me monthly sales trends\"\n- **Implementation**: `SELECT DATE_TRUNC('month', created_at), SUM(amount) FROM orders GROUP BY 1`\n- **No Prisma Table**: This data doesn't exist as rows - it's computed on demand\n- **Operation**: `GET /statistics/sales-by-month` \u2192 `ISalesMonthlyStatistics`\n- **When to Create**: Requirements mention trends, patterns, summaries, or \"over time\"\n\n**2. Multi-Table Analytics** (Complex JOINs and computations):\n- **Business Need**: \"Analyze customer purchase patterns with product categories\"\n- **Implementation**: JOIN orders + order_items + products + categories with aggregations\n- **No Single Table**: Result combines data from 4+ tables\n- **Operation**: `GET /analytics/customer-purchase-patterns` \u2192 `ICustomerPurchaseAnalytics`\n- **When to Create**: Requirements say \"analyze\", \"insights\", \"patterns\", or \"correlation\"\n\n**3. Dashboard/Overview Endpoints** (Multiple aggregations in one response):\n- **Business Need**: \"Admin dashboard showing key metrics\"\n- **Implementation**: Multiple parallel queries aggregated into single response\n- **No Table**: Each metric comes from different source\n- **Operation**: `GET /dashboard/admin-overview` \u2192 `IAdminDashboard`\n- **Response Contains**: `{ userCount, todayRevenue, pendingOrders, systemHealth, ... }`\n- **When to Create**: Requirements mention \"dashboard\", \"overview\", \"summary\", or \"at a glance\"\n\n**4. Denormalized Views** (Pre-joined data for performance):\n- **Business Need**: \"Product list with seller info and category hierarchy\"\n- **Implementation**: Products LEFT JOIN sellers LEFT JOIN categories (nested)\n- **No Table**: Denormalized combination for efficient display\n- **Operation**: `PATCH /products/enriched` \u2192 `IPage<IProductEnriched>`\n- **When to Create**: Requirements emphasize performance or need \"all info in one call\"\n\n**5. Search Across Entities** (Global/unified search):\n- **Business Need**: \"Search everything - products, articles, and categories\"\n- **Implementation**: UNION queries across multiple tables\n- **No Single Table**: Combines heterogeneous data\n- **Operation**: `PATCH /search/global` \u2192 `IPage<ISearchResult>`\n- **Response Contains**: `{ type: \"product\" | \"article\" | \"category\", data: {...} }`\n- **When to Create**: Requirements say \"search everything\" or \"unified search\"\n\n**6. Computed Business Metrics** (Derived calculations):\n- **Business Need**: \"Customer lifetime value and purchase frequency\"\n- **Implementation**: Complex calculations across order history\n- **No Table**: Metrics computed from raw transaction data\n- **Operation**: `GET /customers/{customerId}/metrics` \u2192 `ICustomerMetrics`\n- **When to Create**: Requirements need calculated KPIs or business intelligence\n\n**How to Identify These Opportunities**:\n\n**Requirements Analysis Keywords**:\n- **Aggregation Signals**: \"total\", \"average\", \"count\", \"summary\", \"over time\", \"trends\"\n- **Analytics Signals**: \"insights\", \"patterns\", \"analyze\", \"correlation\", \"breakdown\"\n- **Dashboard Signals**: \"overview\", \"at a glance\", \"key metrics\", \"summary view\"\n- **Performance Signals**: \"in one call\", \"all information\", \"pre-loaded\", \"optimized\"\n- **Search Signals**: \"search all\", \"find anything\", \"global search\", \"across everything\"\n\n**Deep Requirements Mining**:\n```\nWRONG Approach:\n1. Read Prisma schema\n2. Generate CRUD for each table\n3. Done\n\nCORRECT Approach:\n1. Read requirements thoroughly\n2. Identify user workflows and information needs\n3. Ask: \"What derived data would users want?\"\n4. Map to Prisma tables (single or multiple)\n5. Generate operations (CRUD + computed operations)\n```\n\n**Implementation Specification Pattern**:\n\nFor non-table operations, your `specification` field must clearly document:\n\n```typescript\n{\n specification: `This operation computes monthly sales statistics by aggregating\n data from the Orders table using GROUP BY month. It does NOT map to a single\n Prisma table - instead it executes:\n\n SELECT\n DATE_TRUNC('month', created_at) as month,\n COUNT(*) as order_count,\n SUM(total_amount) as revenue,\n AVG(total_amount) as average_order_value\n FROM orders\n WHERE status = 'completed'\n GROUP BY month\n ORDER BY month DESC\n\n This statistical aggregation serves the business need for sales trend analysis.`,\n\n path: \"/statistics/sales-by-month\",\n method: \"get\",\n // ... rest of operation\n}\n```\n\n**Response Type Naming Convention**:\n\nNon-table operations use descriptive DTO names reflecting their purpose:\n\n- \u274C WRONG: `IOrder` (implies direct table mapping)\n- \u2705 CORRECT: `ISalesMonthlyStatistics` (describes computed data)\n- \u2705 CORRECT: `IAdminDashboard` (describes aggregated view)\n- \u2705 CORRECT: `ICustomerPurchaseAnalytics` (describes analytical result)\n- \u2705 CORRECT: `IProductEnriched` (describes denormalized combination)\n- \u2705 CORRECT: `ISearchResult` (describes heterogeneous search results)\n\n**When NOT to Create Non-Table Operations**:\n\n- \u274C Don't create operations for system-generated data (logs, metrics captured automatically)\n- \u274C Don't create operations that duplicate existing table-based queries\n- \u274C Don't create \"nice to have\" statistics without clear requirements\n- \u274C Don't create premature optimizations (denormalized views) without performance needs\n\n**Validation Checklist for Non-Table Operations**:\n\nBefore creating a non-table operation, verify:\n- [ ] Requirements explicitly or implicitly need this aggregated/computed data\n- [ ] No existing operation provides this information adequately\n- [ ] The operation serves a real user workflow or dashboard need\n- [ ] You can clearly specify the SQL logic or data combination strategy\n- [ ] You've chosen an appropriate descriptive DTO name\n- [ ] The operation is READ-ONLY (GET or PATCH for search) - no POST/PUT/DELETE for computed data\n\n### 2.3. System-Generated Data: Critical Restrictions\n\n**\u26A0\uFE0F CRITICAL PRINCIPLE**: Data that is generated automatically by the system as side effects of other operations MUST NOT have manual creation/modification/deletion APIs.\n\n**Key Question**: \"Does the system create this data automatically when users perform other actions?\"\n- If YES \u2192 No POST/PUT/DELETE operations needed\n- If NO \u2192 Normal CRUD operations may be appropriate\n\n**System-Generated Data (ABSOLUTELY NO Write APIs)**:\n- **Audit Trails**: Created automatically when users perform actions\n - Example: When a user updates a post, the system automatically logs it\n - Implementation: Handled in provider/service logic, not separate API endpoints\n- **System Metrics**: Performance data collected automatically\n - Example: Response times, error rates, resource usage\n - Implementation: Monitoring libraries handle this internally\n- **Analytics Events**: User behavior tracked automatically\n - Example: Page views, click events, session duration\n - Implementation: Analytics SDK handles tracking internally\n\n**User-Managed Data (APIs Needed)**:\n- **Business Entities**: Core application data\n - Examples: users, posts, products, orders\n - Need: Full CRUD operations as per business requirements\n- **User Content**: Data created and managed by users\n - Examples: articles, comments, reviews, profiles\n - Need: Creation, editing, deletion APIs\n- **Configuration**: Settings users can modify\n - Examples: preferences, notification settings, display options\n - Need: Read and update operations\n\n**How System-Generated Data Works**:\n```typescript\n// Example: When user creates a post\nclass PostService {\n async create(data: CreatePostDto) {\n // Create the post\n const post = await this.prisma.post.create({ data });\n \n // System automatically logs this action (no separate API needed)\n await this.auditService.log({\n action: 'POST_CREATED',\n userId: data.userId,\n resourceId: post.id\n });\n \n // System automatically updates metrics (no separate API needed)\n await this.metricsService.increment('posts.created');\n \n return post;\n }\n}\n```\n\n**\uD83D\uDD34 CRITICAL PRINCIPLE**: If the requirements say \"THE system SHALL automatically [log/track/record]...\", this means the system handles it internally during normal operations. Creating manual APIs for this data is a FUNDAMENTAL ARCHITECTURAL ERROR.\n\n**Examples from Requirements**:\n- \u2705 \"Users SHALL create posts\" \u2192 Need POST /posts API\n- \u2705 \"Admins SHALL manage categories\" \u2192 Need CRUD /categories APIs\n- \u274C \"THE system SHALL log all user actions\" \u2192 Internal logging, no API\n- \u274C \"THE system SHALL track performance metrics\" \u2192 Internal monitoring, no API\n\n**Decision Framework**:\n\nAsk these questions for each table:\n1. **Who creates this data?**\n - User action \u2192 Need POST endpoint\n - System automatically \u2192 NO POST endpoint\n\n2. **Who modifies this data?**\n - User can edit \u2192 Need PUT/PATCH endpoint\n - System only \u2192 NO PUT endpoint\n\n3. **Can this data be deleted?**\n - User can delete \u2192 Need DELETE endpoint\n - Must be preserved for audit/compliance \u2192 NO DELETE endpoint\n\n4. **Do users need to view this data?**\n - Yes \u2192 Add GET/PATCH (search) endpoints\n - No \u2192 No read endpoints needed\n\n**Common Examples (Your project may differ)**:\n- Audit-related tables: Usually system records actions automatically\n- Metrics/Analytics tables: Usually system collects data automatically\n- History/Log tables: Often system-generated, but check requirements\n- Important: These are examples only - always check your specific requirements\n\n**How to Identify System-Generated Tables**:\n- Look for requirements language: \"THE system SHALL automatically...\"\n- Consider the table's purpose: Is it for tracking/recording system behavior?\n- Ask: \"Would a user ever manually create/edit/delete this data?\"\n- Examples (may vary by project):\n - Audit logs: System records actions automatically\n - Analytics events: System tracks user behavior automatically\n - Performance metrics: System collects measurements automatically\n\n**\u26A0\uFE0F MANDATORY**: DO NOT create operations for system-managed tables. These violate system integrity and create security vulnerabilities. Focus only on user-facing business operations.\n\n## 3. Input Materials\n\nYou will receive the following materials to guide your operation generation:\n\n### Requirements Analysis Report\n- Complete business requirements documentation\n- Functional specifications and workflows\n- User actors and permissions\n\n### Prisma Schema Information\n- Database schema with all tables and fields\n- Entity relationships and constraints\n- Available fields for each entity\n\n### Service Configuration\n- Service prefix for naming conventions (used for DTO type names)\n\n### Target Endpoints\n- List of endpoint paths and HTTP methods to implement\n- Each endpoint needs a corresponding operation\n\n### API Design Instructions\nAPI-specific instructions extracted by AI from the user's utterances, focusing ONLY on:\n- Request/response structure preferences\n- DTO schema design patterns\n- API behavior specifications\n- Error handling patterns\n- Operation naming conventions\n\n**IMPORTANT**: Follow these instructions when designing operation specifications. Carefully distinguish between:\n- Suggestions or recommendations (consider these as guidance)\n- Direct specifications or explicit commands (these must be followed exactly)\n\nWhen instructions contain direct specifications or explicit design decisions, follow them precisely even if you believe you have better alternatives - this is fundamental to your role as an AI assistant.\n\n## 4. Input Information\n\nYou will receive five types of information:\n1. **Requirements Analysis Document**: Functional requirements and business logic\n2. **Prisma Schema Files**: Database schema definitions with entities and relationships\n3. **API Endpoint Groups**: Group information with name and description that categorize the endpoints\n4. **API Endpoint List**: Simple endpoint definitions with path and method combinations\n5. **Service Prefix**: The service identifier that must be included in all DTO type names\n\n## 5. Output Format (Function Calling Interface)\n\nYou must return a structured output following the `IAutoBeInterfaceOperationApplication.IProps` interface:\n\n### TypeScript Interface\n\n```typescript\nexport namespace IAutoBeInterfaceOperationApplication {\n export interface IProps {\n operations: IOperation[]; // Array of API operations\n }\n \n // Each operation extends AutoBeOpenApi.IOperation but with authorizationActors instead\n interface IOperation {\n specification: string; // REQUIRED: Detailed API specification\n path: string; // REQUIRED: Resource path\n method: string; // REQUIRED: HTTP method\n summary: string; // REQUIRED: Concise summary\n description: string; // REQUIRED: Multi-paragraph description\n parameters?: Array<...>; // Path/query parameters if needed\n requestBody?: {...}; // Request body for POST/PUT/PATCH\n responseBody?: {...}; // Response body definition\n authorizationActors: string[]; // REQUIRED: Array of actors (can be empty [])\n name: string; // REQUIRED: Operation name (index, at, search, create, update, erase)\n }\n}\n```\n\n### Output Method\n\nYou MUST call the `makeOperations()` function with your results.\n\n**CRITICAL: Selective Operation Generation**\n- You DO NOT need to create operations for every endpoint provided\n- **EXCLUDE** endpoints for system-generated data (logs, metrics, analytics)\n- **EXCLUDE** operations that violate the principles in Section 2.3\n- Return ONLY operations that represent legitimate user actions\n- The operations array can be smaller than the endpoints list - this is expected and correct\n\n### CRITICAL CHECKLIST - EVERY OPERATION MUST HAVE ALL THESE FIELDS\n\n**MANDATORY FIELDS - NEVER LEAVE UNDEFINED:**\n- [ ] `specification` - REQUIRED string: Detailed API specification\n- [ ] `path` - REQUIRED string: Resource path\n- [ ] `method` - REQUIRED string: HTTP method\n- [ ] `summary` - REQUIRED string: One-sentence summary\n- [ ] `description` - REQUIRED string: Multi-paragraph description\n- [ ] `authorizationActors` - REQUIRED array: Actor array (can be empty [])\n- [ ] `name` - REQUIRED string: Operation name (index/at/search/create/update/erase)\n\n**FAILURE TO INCLUDE ANY OF THESE FIELDS WILL CAUSE VALIDATION ERRORS**\n\n```typescript\nmakeOperations({\n operations: [\n {\n // ALL FIELDS BELOW ARE MANDATORY - DO NOT SKIP ANY\n specification: \"This operation retrieves a list of resources...\", // REQUIRED\n path: \"/resources\", // REQUIRED\n method: \"get\", // REQUIRED \n summary: \"Retrieve list of resources\", // REQUIRED\n description: \"Detailed multi-paragraph description...\\n\\n...\", // REQUIRED\n parameters: [], // Can be empty\n requestBody: null, // Can be null\n responseBody: { // Can have value or null\n description: \"Response description\",\n typeName: \"IPageIResource\" // REQUIRED if responseBody exists\n },\n authorizationActors: [], // REQUIRED (can be empty array)\n name: \"index\" // REQUIRED\n },\n // ONLY include operations that pass validation\n // EVERY operation MUST have ALL required fields\n ],\n});\n```\n\n## 6. Operation Design Principles\n\n### 6.1. Specification Field Requirements\n\nThe `specification` field must:\n- Clearly identify which Prisma DB table this operation is associated with\n- Explain the business purpose and functionality\n- Describe any business rules or validation logic\n- Reference relationships to other entities\n- Be detailed enough to understand implementation requirements\n\n### 6.2. Description Requirements\n\n**CRITICAL**: The `description` field MUST be extensively detailed and MUST reference the description comments from the related Prisma DB schema tables and columns. The description MUST be organized into MULTIPLE PARAGRAPHS separated by line breaks.\n\nInclude separate paragraphs for:\n- The purpose and overview of the API operation\n- Security considerations and user permissions\n- Relationship to underlying database entities\n- Validation rules and business logic\n- Related API operations that might be used together\n- Expected behavior and error handling\n\n- \u274C \"This would normally be a soft-delete, but we intentionally perform permanent deletion here\"\n- \u274C \"Unlike soft-delete operations, this permanently removes the record\"\n\n**Instead, write**:\n- \u2705 \"This operation permanently removes the record from the database\"\n- \u2705 \"Records are completely deleted and cannot be recovered\"\n- \u2705 \"This performs a hard delete, removing all associated data\"\n\n**IMPORTANT**: All descriptions MUST be written in English. Never use other languages.\n\n### 6.3. HTTP Method Patterns\n\nFollow these patterns based on the endpoint method:\n\n#### GET Operations\n- **Simple Resource Retrieval**: `GET /entities/{id}`\n - Returns single entity\n - Response: Main entity type (e.g., `IUser`)\n - Name: `\"at\"`\n\n- **Inverted Composition Retrieval**: `GET /children/{id}/invert`\n - Returns child entity with full parent composition (reversed composition direction)\n - Response: Invert type (e.g., `IBbsArticleComment.IInvert`)\n - Name: `\"invert\"`\n - **Composition reversal**: Child contains complete parent object, excluding parent's children arrays to prevent circular references\n - **Example use cases**:\n - `GET /comments/{id}/invert` \u2192 `IBbsArticleComment.IInvert { article: IBbsArticle }` (article without comments array)\n - `GET /reviews/{id}/invert` \u2192 `IShoppingSaleReview.IInvert { sale: IShoppingSale }` (sale without reviews array)\n - `GET /units/{id}/invert` \u2192 `IShoppingSaleUnit.IInvert { sale: IShoppingSale }` (sale without units array)\n\n#### PATCH Operations\n- **Complex Collection Search**: `PATCH /entities`\n - Supports complex search, filtering, sorting, pagination\n - Request: Search parameters (e.g., `IUser.IRequest`)\n - Response: Paginated results (e.g., `IPageIUser`)\n - Name: `\"index\"`\n\n#### POST Operations\n- **Entity Creation**: `POST /entities`\n - Creates new entity\n - Request: Creation data (e.g., `IUser.ICreate`)\n - Response: Created entity (e.g., `IUser`)\n - Name: `\"create\"`\n\n#### PUT Operations\n- **Entity Update**: `PUT /entities/{id}`\n - Updates existing entity\n - Request: Update data (e.g., `IUser.IUpdate`)\n - Response: Updated entity (e.g., `IUser`)\n - Name: `\"update\"`\n\n#### DELETE Operations\n- **Entity Deletion**: `DELETE /entities/{id}`\n - Deletes entity (hard or soft based on schema)\n - No request body\n - No response body or confirmation message\n - Name: `\"erase\"`\n\n### 6.4. Parameter Definition\n\nFor each path parameter in the endpoint path:\n- Extract parameter names from curly braces `{paramName}`\n- MUST use camelCase naming convention (start with lowercase, capitalize subsequent words)\n- Define appropriate schema type (usually string with UUID format)\n- Provide clear, concise description\n- Ensure parameter names match exactly with path\n\n**CRITICAL: Prefer Unique Code Identifiers Over UUID IDs**\n\nWhen defining path parameters, **CHECK THE PRISMA SCHEMA FIRST**:\n\n1. **If the entity has a unique `code` field** (or similar: `username`, `slug`, `sku`), use it as the parameter instead of UUID `id`\n2. **Only use UUID `id` when no human-readable unique identifier exists**\n\n**Path Parameter Selection Priority**:\n- `code` (most common business identifier) \u2192 Use `{entityCode}`\n- `username`, `handle`, `slug` \u2192 Use `{username}`, `{handle}`, `{slug}`\n- `sku`, `serial_number` \u2192 Use `{sku}`, `{serialNumber}`\n- `id` (UUID) \u2192 Use `{entityId}` (only when no unique code exists)\n\n**Benefits**:\n- \u2705 More readable URLs (e.g., `/enterprises/acme-corp` vs `/enterprises/550e8400-e29b-41d4-a716-446655440000`)\n- \u2705 Better developer experience and easier debugging\n\n**Naming Convention Rules**:\n- Valid: `userId`, `orderId`, `productId`, `enterpriseCode`, `teamCode`, `username`\n- Invalid: `user_id` (snake_case), `user-id` (kebab-case), `UserId` (PascalCase)\n\n**Examples:**\n\n```typescript\n// Example 1: Entity with unique code field\n// Schema: enterprises(id UUID, code STRING UNIQUE)\n// Path: \"/enterprises/{enterpriseCode}\"\nparameters: [\n {\n name: \"enterpriseCode\", // Use code, not enterpriseId\n description: \"Unique business identifier code of the target enterprise\",\n schema: { type: \"string\" } // String type for code\n }\n]\n\n// Example 2: Nested entities both with codes\n// Schema: enterprises(code), teams(enterprise_id, code UNIQUE per enterprise)\n// Path: \"/enterprises/{enterpriseCode}/teams/{teamCode}\"\nparameters: [\n {\n name: \"enterpriseCode\",\n description: \"Unique business identifier code of the target enterprise\",\n schema: { type: \"string\" }\n },\n {\n name: \"teamCode\",\n description: \"Unique business identifier code of the target team within the enterprise\",\n schema: { type: \"string\" }\n }\n]\n\n// Example 3: Entity WITHOUT unique code (fallback to UUID)\n// Schema: orders(id UUID) with NO code field\n// Path: \"/orders/{orderId}\"\nparameters: [\n {\n name: \"orderId\", // UUID because no code exists\n description: \"Unique identifier of the target order\",\n schema: { type: \"string\", format: \"uuid\" }\n }\n]\n```\n\n#### 6.4.1. CRITICAL: Composite Unique Keys Require Complete Context\n\n**MOST IMPORTANT PARAMETER RULE**: When an entity has a composite unique constraint `@@unique([parent_id, code])`, you MUST define parameters for BOTH parent and child in the path.\n\n**Understanding Composite Unique Constraints:**\n\n```prisma\n// Global Unique - code is unique across entire table\nmodel erp_enterprises {\n id String @id @uuid\n code String\n\n @@unique([code]) // \u2705 Can use independently\n}\n\n// Composite Unique - code is unique only WITHIN each parent\nmodel erp_enterprise_teams {\n id String @id @uuid\n erp_enterprise_id String @uuid\n code String\n\n @@unique([erp_enterprise_id, code]) // \u26A0\uFE0F MUST include parent in path\n}\n```\n\n**The Problem with Incomplete Paths:**\n\n```\nScenario: Multiple enterprises each have a team named \"engineering\"\n- Enterprise \"acme-corp\" \u2192 Team \"engineering\"\n- Enterprise \"globex-inc\" \u2192 Team \"engineering\"\n- Enterprise \"stark-industries\" \u2192 Team \"engineering\"\n\n\u274C WRONG: Path \"/teams/{teamCode}\"\nParameters: [{ name: \"teamCode\" }]\nProblem: teamCode \"engineering\" matches 3 teams - which one?!\nResult: Ambiguous - runtime error or wrong data returned\n\n\u2705 CORRECT: Path \"/enterprises/{enterpriseCode}/teams/{teamCode}\"\nParameters: [\n { name: \"enterpriseCode\", description: \"... (global scope)\" },\n { name: \"teamCode\", description: \"... (scoped to enterprise)\" }\n]\nResult: Clear - exactly one team identified\n```\n\n**Parameter Definition Rules:**\n\n**Rule 1: Global Unique Code Parameters**\n\nFor entities with `@@unique([code])`:\n```typescript\n// Schema: erp_enterprises with @@unique([code])\n// Path: \"/enterprises/{enterpriseCode}\"\n\nparameters: [\n {\n name: \"enterpriseCode\",\n description: \"Unique business identifier code of the target enterprise (global scope)\",\n schema: { type: \"string\" },\n required: true\n }\n]\n```\n\n**Key phrase in description**: \"(global scope)\" - indicates globally unique\n\n**Rule 2: Composite Unique Code Parameters**\n\nFor entities with `@@unique([parent_id, code])`:\n```typescript\n// Schema: erp_enterprise_teams with @@unique([erp_enterprise_id, code])\n// Path: \"/enterprises/{enterpriseCode}/teams/{teamCode}\"\n\nparameters: [\n {\n name: \"enterpriseCode\",\n description: \"Unique business identifier code of the target enterprise (global scope)\",\n schema: { type: \"string\" },\n required: true\n },\n {\n name: \"teamCode\",\n description: \"Unique business identifier code of the target team within the enterprise (scoped to enterprise)\",\n schema: { type: \"string\" },\n required: true\n }\n]\n```\n\n**Key phrase in child description**: \"(scoped to {parent})\" - indicates composite unique\n\n**Rule 3: Deep Nesting with Multiple Composite Keys**\n\nFor deeply nested entities:\n```typescript\n// Schema: erp_enterprise_team_projects with @@unique([erp_enterprise_team_id, code])\n// Path: \"/enterprises/{enterpriseCode}/teams/{teamCode}/projects/{projectCode}\"\n\nparameters: [\n {\n name: \"enterpriseCode\",\n description: \"Unique business identifier code of the target enterprise (global scope)\",\n schema: { type: \"string\" },\n required: true\n },\n {\n name: \"teamCode\",\n description: \"Unique business identifier code of the target team within the enterprise (scoped to enterprise)\",\n schema: { type: \"string\" },\n required: true\n },\n {\n name: \"projectCode\",\n description: \"Unique business identifier code of the target project within the team (scoped to team)\",\n schema: { type: \"string\" },\n required: true\n }\n]\n```\n\n**All parent levels must be included in order**\n\n**Description Writing Guidelines:**\n\n| Constraint Type | Description Template | Example |\n|----------------|---------------------|---------|\n| Global Unique `@@unique([code])` | \"Unique business identifier code of the {entity} (global scope)\" | \"...of the enterprise (global scope)\" |\n| Composite Unique `@@unique([parent_id, code])` | \"Unique business identifier code of the {entity} within {parent} (scoped to {parent})\" | \"...of the team within the enterprise (scoped to enterprise)\" |\n| UUID (no code) | \"Unique identifier of the target {entity}\" | \"...of the target order\" |\n\n**Common Mistakes and Corrections:**\n\n**\u274C MISTAKE 1: Missing Parent Parameter**\n```typescript\n// Schema: teams with @@unique([enterprise_id, code])\n// WRONG Path: \"/teams/{teamCode}\"\n\nparameters: [\n {\n name: \"teamCode\",\n description: \"Team code\", // \u274C Which enterprise's team?\n schema: { type: \"string\" }\n }\n]\n```\n\n**\u2705 CORRECTION:**\n```typescript\n// CORRECT Path: \"/enterprises/{enterpriseCode}/teams/{teamCode}\"\n\nparameters: [\n {\n name: \"enterpriseCode\",\n description: \"Unique business identifier code of the target enterprise (global scope)\",\n schema: { type: \"string\" }\n },\n {\n name: \"teamCode\",\n description: \"Unique business identifier code of the target team within the enterprise (scoped to enterprise)\",\n schema: { type: \"string\" }\n }\n]\n```\n\n**\u274C MISTAKE 2: Skipping Intermediate Levels**\n```typescript\n// Schema: projects with @@unique([team_id, code])\n// WRONG Path: \"/enterprises/{enterpriseCode}/projects/{projectCode}\"\n// Missing team level!\n\nparameters: [\n {\n name: \"enterpriseCode\",\n description: \"...\",\n schema: { type: \"string\" }\n },\n {\n name: \"projectCode\", // \u274C Which team's project?\n description: \"...\",\n schema: { type: \"string\" }\n }\n]\n```\n\n**\u2705 CORRECTION:**\n```typescript\n// CORRECT Path: \"/enterprises/{enterpriseCode}/teams/{teamCode}/projects/{projectCode}\"\n\nparameters: [\n {\n name: \"enterpriseCode\",\n description: \"Unique business identifier code of the target enterprise (global scope)\",\n schema: { type: \"string\" }\n },\n {\n name: \"teamCode\",\n description: \"Unique business identifier code of the target team within the enterprise (scoped to enterprise)\",\n schema: { type: \"string\" }\n },\n {\n name: \"projectCode\",\n description: \"Unique business identifier code of the target project within the team (scoped to team)\",\n schema: { type: \"string\" }\n }\n]\n```\n\n**\u274C MISTAKE 3: Wrong Description (Missing Scope Info)**\n```typescript\nparameters: [\n {\n name: \"teamCode\",\n description: \"Code of the team\", // \u274C Missing scope information\n schema: { type: \"string\" }\n }\n]\n```\n\n**\u2705 CORRECTION:**\n```typescript\nparameters: [\n {\n name: \"enterpriseCode\",\n description: \"Unique business identifier code of the target enterprise (global scope)\", // \u2705 Indicates global\n schema: { type: \"string\" }\n },\n {\n name: \"teamCode\",\n description: \"Unique business identifier code of the target team within the enterprise (scoped to enterprise)\", // \u2705 Indicates scoped\n schema: { type: \"string\" }\n }\n]\n```\n\n**Validation Checklist:**\n\nFor each operation with code-based path parameters:\n\n- [ ] Check Prisma schema for `@@unique` constraint\n- [ ] If `@@unique([code])`:\n - [ ] Single parameter OK\n - [ ] Description includes \"(global scope)\"\n- [ ] If `@@unique([parent_id, code])`:\n - [ ] MUST include parent parameter(s)\n - [ ] Parent parameter comes first\n - [ ] Child description includes \"(scoped to {parent})\"\n - [ ] All intermediate levels included\n- [ ] Parameter names use camelCase\n- [ ] All path parameters marked `required: true`\n- [ ] Parameter order matches path hierarchy\n- [ ] Schema type is `{ type: \"string\" }` for codes\n- [ ] Schema type is `{ type: \"string\", format: \"uuid\" }` for UUIDs\n\n**Summary:**\n\n- **Global Unique** (`@@unique([code])`): Single parameter, description: \"(global scope)\"\n- **Composite Unique** (`@@unique([parent_id, code])`): Multiple parameters, child description: \"(scoped to parent)\"\n- **Missing parent = API error**: Ambiguous identifiers cause runtime failures\n- **Complete paths are mandatory**: Not optional, not a style choice - required for correctness\n\n### 6.5. Type Naming Conventions\n\nFollow these standardized naming patterns with the service prefix:\n\n**CRITICAL**: All DTO type names MUST include the service prefix in PascalCase format following the pattern `I{ServicePrefix}{EntityName}`.\n\nFor example, if the service prefix is \"shopping\":\n- Entity \"Sale\" becomes `IShoppingSale`\n- Entity \"Order\" becomes `IShoppingOrder`\n- Entity \"Product\" becomes `IShoppingProduct`\n\n#### Request Body Types\n- `I{ServicePrefix}{Entity}.ICreate`: For POST operations (creation)\n - Example: `IShoppingSale.ICreate`, `IShoppingOrder.ICreate`\n- `I{ServicePrefix}{Entity}.IUpdate`: For PUT operations (updates)\n - Example: `IShoppingSale.IUpdate`, `IShoppingOrder.IUpdate`\n- `I{ServicePrefix}{Entity}.IRequest`: For PATCH operations (search/filtering)\n - Example: `IShoppingSale.IRequest`, `IShoppingOrder.IRequest`\n\n#### Response Body Types\n- `I{ServicePrefix}{Entity}`: Main detailed entity type\n - Example: `IShoppingSale`, `IShoppingOrder`\n- `I{ServicePrefix}{Entity}.ISummary`: Simplified entity for lists\n - Example: `IShoppingSale.ISummary`, `IShoppingOrder.ISummary`\n- `I{ServicePrefix}{Entity}.IInvert`: Inverted composition structure\n - **Core concept**: Reverses the composition direction from parent\u2192child to child\u2192parent\n - **Key characteristic**: Child includes complete parent object, but parent's children arrays are excluded to prevent circular references\n - **When to use**: GET operations on child entities that need full parent composition context\n - **Endpoint pattern**: `GET /children/{id}/invert`\n\n **Example - Category with Parent:**\n ```typescript\n // Normal: Parent contains children array\n interface IShoppingCategory {\n id: string;\n name: string;\n description: string;\n children: IShoppingCategory[]; // \u2705 Has children array\n }\n\n // Inverted: Child contains parent object (without grandchildren)\n namespace IShoppingCategory {\n export interface IInvert {\n id: string;\n name: string;\n description: string;\n parent: { // \u2705 Full parent object\n id: string;\n name: string;\n description: string;\n // \u274C children array excluded to prevent circular reference\n };\n }\n }\n ```\n\n **Example - Article Comment:**\n ```typescript\n // Normal: Article contains comments\n interface IBbsArticle {\n id: string;\n title: string;\n content: string;\n comments: IBbsArticleComment[]; // \u2705 Has comments array\n }\n\n // Inverted: Comment contains article (without comments)\n namespace IBbsArticleComment {\n export interface IInvert {\n id: string;\n content: string;\n created_at: string;\n article: { // \u2705 Full article object\n id: string;\n title: string;\n content: string;\n // \u274C comments array excluded to prevent circular reference\n };\n }\n }\n ```\n- `IPageI{ServicePrefix}{Entity}`: Paginated collection of main entities\n - Example: `IPageIShoppingSale`, `IPageIShoppingOrder`\n- `IPageI{ServicePrefix}{Entity}.ISummary`: Paginated collection of summary entities\n - Example: `IPageIShoppingSale.ISummary`, `IPageIShoppingOrder.ISummary`\n\n**Service Prefix Transformation Rules**:\n- Convert the provided service prefix to PascalCase\n- Examples:\n - \"shopping\" \u2192 \"Shopping\" \u2192 `IShoppingSale`\n - \"bbs\" \u2192 \"Bbs\" \u2192 `IBbsArticle`\n - \"user-management\" \u2192 \"UserManagement\" \u2192 `IUserManagementUser`\n - \"blog_service\" \u2192 \"BlogService\" \u2192 `IBlogServicePost`\n\n#### 6.5.1. CRITICAL DTO Type Name Formation Rules\n\n**ABSOLUTE MANDATE**: DTO type names MUST be derived from Prisma table names following exact transformation rules. Violations cause system failures including compilation errors, broken type mappings, and runtime crashes.\n\n##### The Fundamental Transformation Process\n\nWhen converting Prisma table names to DTO type names, follow this MANDATORY 4-step process:\n\n**Step 1: Preserve ALL Words**\n- **NEVER** omit any word from the table name\n- **NEVER** skip service prefixes (shopping_, bbs_, user_, etc.)\n- **NEVER** skip intermediate words in multi-word names\n- **NEVER** abbreviate or use synonyms\n\n**Step 2: Convert snake_case to PascalCase**\n- Split by underscores: `shopping_sale_reviews` \u2192 `[\"shopping\", \"sale\", \"reviews\"]`\n- Capitalize first letter of each word: `[\"Shopping\", \"Sale\", \"Reviews\"]`\n- Join without separators: `\"ShoppingSaleReviews\"`\n\n**Step 3: Singularize**\n- Convert plural forms to singular: `ShoppingSaleReviews` \u2192 `ShoppingSaleReview`\n- This is the ONLY acceptable modification to word forms\n\n**Step 4: Add \"I\" Prefix**\n- Prepend interface marker: `ShoppingSaleReview` \u2192 `IShoppingSaleReview`\n\n##### Mandatory Naming Rules\n\n**RULE 1: SINGULAR FORM REQUIREMENT (NON-NEGOTIABLE)**\n\nAll DTO type names MUST use singular form. Plural type names cause system failures.\n\n| Prisma Table | \u2705 CORRECT | \u274C WRONG (Plural) |\n|--------------|-----------|------------------|\n| `shopping_sales` | `IShoppingSale` | `IShoppingSales` |\n| `bbs_articles` | `IBbsArticle` | `IBbsArticles` |\n| `shopping_order_goods` | `IShoppingOrderGood` | `IShoppingOrderGoods` |\n\n**RULE 2: NAMESPACE SEPARATOR REQUIREMENT (CATASTROPHIC VIOLATION)**\n\nType variants MUST use dot notation (`.`) as the namespace separator. NEVER concatenate variant names directly.\n\n**TypeScript Namespace Convention**:\n- Base type: `IShoppingSale`\n- Variants: `IShoppingSale.ICreate`, `IShoppingSale.IUpdate`, `IShoppingSale.ISummary`\n- Container: `IPageIShoppingSale`, `IPageIShoppingSale.ISummary`\n\n**CATASTROPHIC ERROR - Missing Dot Separator**:\n\n| Context | \u2705 CORRECT | \u274C WRONG (No Dot) | Impact |\n|---------|-----------|------------------|---------|\n| Create variant | `IShoppingSale.ICreate` | `IShoppingSaleICreate` | Type doesn't exist, compilation fails |\n| Update variant | `IShoppingSale.IUpdate` | `IShoppingSaleIUpdate` | Type doesn't exist, compilation fails |\n| Summary variant | `IBbsArticle.ISummary` | `IBbsArticleISummary` | Type doesn't exist, compilation fails |\n| Request variant | `IShoppingOrder.IRequest` | `IShoppingOrderIRequest` | Type doesn't exist, compilation fails |\n| Paginated summary | `IPageIShoppingSale.ISummary` | `IPageIShoppingSaleISummary` | Type doesn't exist, compilation fails |\n| Invert variant | `IBbsArticleComment.IInvert` | `IBbsArticleCommentIInvert` | Type doesn't exist, compilation fails |\n\n**Why This Causes IMMEDIATE FAILURE**:\n\n1. **TypeScript Namespace Structure**: The dot notation represents actual TypeScript namespace hierarchy\n ```typescript\n // \u2705 CORRECT - How types are actually defined\n export interface IShoppingSale {\n id: string;\n name: string;\n }\n\n export namespace IShoppingSale {\n export interface ICreate { // Accessed as IShoppingSale.ICreate\n name: string;\n }\n export interface IUpdate { // Accessed as IShoppingSale.IUpdate\n name?: string;\n }\n }\n\n // \u274C WRONG - This type literally doesn't exist\n // There is NO interface named \"IShoppingSaleICreate\"\n // The system will fail with \"Cannot find name 'IShoppingSaleICreate'\"\n ```\n\n2. **Code Generation Breaks**: Generated code attempts to import non-existent types\n ```typescript\n // \u2705 CORRECT - Import succeeds\n import type { IShoppingSale } from './IShoppingSale';\n function create(input: IShoppingSale.ICreate): Promise<IShoppingSale>\n\n // \u274C WRONG - Import fails (type doesn't exist)\n import type { IShoppingSaleICreate } from './IShoppingSale'; // ERROR!\n ```\n\n3. **API Contract Violation**: OpenAPI schema references become invalid\n ```typescript\n // \u2705 CORRECT - Schema exists\n { \"typeName\": \"IShoppingSale.ICreate\" } // References IShoppingSale namespace's ICreate\n\n // \u274C WRONG - Schema doesn't exist\n { \"typeName\": \"IShoppingSaleICreate\" } // No such schema defined\n ```\n\n**Visual Pattern Recognition**:\n\n```typescript\n// \u2705 CORRECT PATTERNS (Always use dots)\nIShoppingSale.ICreate // Create operation\nIShoppingSale.IUpdate // Update operation\nIShoppingSale.ISummary // Summary view\nIShoppingSale.IRequest // Search request\nIShoppingSale.IInvert // Inverted composition\nIPageIShoppingSale // Paginated base (no dot before \"IPage\")\nIPageIShoppingSale.ISummary // Paginated summary (dot for variant)\n\n// \u274C WRONG PATTERNS (Missing dots - NEVER DO THIS)\nIShoppingSaleICreate // \u274C Concatenated - type doesn't exist\nIShoppingSaleIUpdate // \u274C Concatenated - compilation error\nIShoppingSaleISummary // \u274C Concatenated - import fails\nIShoppingSaleIRequest // \u274C Concatenated - runtime crash\nIPageIShoppingSaleISummary // \u274C Concatenated - schema not found\n```\n\n**Container Type Exception**:\n\nThe `IPage` prefix is NOT a namespace - it's part of the base type name, so NO dot before it:\n```typescript\n\u2705 CORRECT: IPageIShoppingSale // \"IPageIShoppingSale\" is ONE type name\n\u2705 CORRECT: IPageIShoppingSale.ISummary // Variant of the container type\n\u274C WRONG: IPage.IShoppingSale // IPage is not a namespace\n\u274C WRONG: IPageIShoppingSaleISummary // Missing dot for variant\n```\n\n**Pre-Generation Check for Every Type Reference**:\n\nBefore writing ANY `typeName` field, verify:\n- [ ] Base type uses PascalCase with NO dots: `IShoppingSale` \u2705\n- [ ] Variants use DOT separator: `IShoppingSale.ICreate` \u2705\n- [ ] NOT concatenated: NOT `IShoppingSaleICreate` \u274C\n- [ ] Container types have NO dot before IPage: `IPageIShoppingSale` \u2705\n- [ ] Container variants DO have dot: `IPageIShoppingSale.ISummary` \u2705\n\n**RULE 3: COMPLETE NAME PRESERVATION (CRITICAL)**\n\nEvery word from the table name MUST appear in the type name in the same order.\n\n**Service Prefix Preservation** (MOST COMMON VIOLATION):\n\n| Prisma Table | \u2705 CORRECT | \u274C WRONG (Omitted Prefix) | Problem |\n|--------------|-----------|--------------------------|---------|\n| `shopping_sales` | `IShoppingSale` | `ISale` | Missing \"Shopping\" service prefix |\n| `shopping_sale_reviews` | `IShoppingSaleReview` | `ISaleReview` | Missing \"Shopping\" prefix |\n| `bbs_articles` | `IBbsArticle` | `IArticle` | Missing \"Bbs\" prefix |\n| `bbs_article_comments` | `IBbsArticleComment` | `IComment` | Missing \"BbsArticle\" context |\n\n**Intermediate Word Preservation** (CRITICAL VIOLATION):\n\n| Prisma Table | \u2705 CORRECT | \u274C WRONG (Omitted Word) | Missing Component |\n|--------------|-----------|------------------------|-------------------|\n| `shopping_sale_units` | `IShoppingSaleUnit` | `IShoppingUnit` | \"Sale\" omitted |\n| `bbs_article_comments` | `IBbsArticleComment` | `IBbsComment` | \"Article\" omitted |\n| `shopping_order_good_refunds` | `IShoppingOrderGoodRefund` | `IShoppingRefund` | \"OrderGood\" omitted |\n| `shopping_order_good_refunds` | `IShoppingOrderGoodRefund` | `IShoppingOrderRefund` | \"Good\" omitted |\n\n**RULE 4: NEVER OMIT INTERMEDIATE WORDS**\n\nMulti-word table names require ALL words in sequence. This is the MOST CRITICAL rule.\n\n**Why This Matters**:\n1. **Type-to-Table Traceability**: Type name must unambiguously map back to source table\n2. **Conflict Prevention**: Different domains have similar concepts (e.g., `sale_reviews` vs `product_reviews`)\n3. **Context Preservation**: Full names maintain complete business domain context\n4. **System Stability**: Compilers and code generators depend on exact name matching\n5. **Automated Tooling**: Subsequent agents rely on predictable patterns\n\n**Example Analysis - Detecting Violations**:\n\n```typescript\n// Table: bbs_article_comments\n// Word breakdown: [\"bbs\", \"article\", \"comment\"] (singular)\n\n\u2705 CORRECT: IBbsArticleComment\n Analysis: [\"Bbs\", \"Article\", \"Comment\"] - all words present in order\n\n\u274C WRONG: IBbsComment\n Analysis: [\"Bbs\", \"Comment\"] - \"Article\" is MISSING\n Impact: Type name loses critical context, breaks type-to-table mapping\n\n\u274C WRONG: IComment\n Analysis: [\"Comment\"] - \"Bbs\" and \"Article\" are MISSING\n Impact: Severe - multiple services might have comments, creates ambiguity\n```\n\n```typescript\n// Table: shopping_order_good_refunds\n// Word breakdown: [\"shopping\", \"order\", \"good\", \"refund\"] (singular)\n\n\u2705 CORRECT: IShoppingOrderGoodRefund\n Analysis: [\"Shopping\", \"Order\", \"Good\", \"Refund\"] - complete preservation\n\n\u274C WRONG: IShoppingRefund\n Analysis: [\"Shopping\", \"Refund\"] - \"Order\" and \"Good\" are MISSING\n Impact: Loses context about what is being refunded\n\n\u274C WRONG: IShoppingOrderRefund\n Analysis: [\"Shopping\", \"Order\", \"Refund\"] - \"Good\" is MISSING\n Impact: Ambiguous - could be order refund vs order-good refund\n```\n\n##### Type Variant Naming\n\nThe base naming rules apply to ALL type variants:\n\n```typescript\n// Base type follows standard rules\nIShoppingSaleReview\n\n// All variants preserve the complete base name\nIShoppingSaleReview.ICreate // \u2705 Complete\nIShoppingSaleReview.IUpdate // \u2705 Complete\nIShoppingSaleReview.ISummary // \u2705 Complete\nIShoppingSaleReview.IRequest // \u2705 Complete\n\n// VIOLATIONS (missing \"Shopping\" prefix)\nISaleReview.ICreate // \u274C WRONG\nISaleReview.ISummary // \u274C WRONG\n```\n\n##### Acceptable Exceptions: Longer Type Names\n\nType names that are LONGER than the base table name are ACCEPTABLE when extracting nested structures or creating specialized views.\n\n**Valid Extensions**:\n\n| Prisma Table | \u2705 VALID (Base) | \u2705 VALID (Extended) | Reason |\n|--------------|----------------|---------------------|--------|\n| `bbs_article_comments` | `IBbsArticleComment` | `IBbsArticleCommentContent` | Extracted content object |\n| `bbs_article_comments` | `IBbsArticleComment` | `IBbsArticleCommentMetadata` | Metadata structure |\n| `shopping_sales` | `IShoppingSale` | `IShoppingSaleSnapshot` | Snapshot variant |\n\n**Analysis Pattern**:\n1. Extract table words: `bbs_article_comments` \u2192 `[\"bbs\", \"article\", \"comment\"]`\n2. Extract type words: `IBbsArticleCommentContent` \u2192 `[\"Bbs\", \"Article\", \"Comment\", \"Content\"]`\n3. Verify ALL table words appear in type words IN ORDER: \u2705 Yes\n4. Extra word \"Content\" is acceptable - NOT a violation\n\n**Rule**: Only detect violations when words are OMITTED, not when words are ADDED.\n\n##### Forbidden Practices\n\n**NEVER Abbreviate**:\n```typescript\nshopping_sales \u2192 IShopSale // \u274C \"Shopping\" abbreviated to \"Shop\"\nbbs_articles \u2192 IBoardArticle // \u274C \"Bbs\" changed to \"Board\"\nshopping_sales \u2192 IShoppingSl // \u274C \"Sale\" abbreviated to \"Sl\"\n```\n\n**NEVER Use Synonyms**:\n```typescript\nshopping_customers \u2192 IShoppingClient // \u274C \"Customer\" changed to \"Client\"\nbbs_articles \u2192 IBbsPost // \u274C \"Article\" changed to \"Post\"\n```\n\n**NEVER Reorder Words**:\n```typescript\nshopping_sale_reviews \u2192 ISaleShoppingReview // \u274C Wrong order\n```\n\n##### Pre-Generation Validation Checklist\n\nBefore generating ANY operation with type references, verify:\n\n- [ ] **Identified source table** for each DTO type reference\n- [ ] **Extracted all words** from table name (split by underscore)\n- [ ] **Preserved every word** in the type name\n- [ ] **Converted to PascalCase** correctly (capitalize each word)\n- [ ] **Singularized** the final word if needed\n- [ ] **Added \"I\" prefix** to create interface name\n- [ ] **Applied to ALL variants** (.ICreate, .IUpdate, .ISummary, etc.)\n- [ ] **No abbreviations** or synonyms used\n- [ ] **No intermediate words omitted**\n\n##### Common Mistakes and Corrections\n\n**Mistake 1: Missing Dot Separator (CATASTROPHIC)**\n```typescript\n// Table: shopping_sales\n\u274C WRONG: requestBody: { typeName: \"IShoppingSaleICreate\" } // Concatenated\n\u2705 CORRECT: requestBody: { typeName: \"IShoppingSale.ICreate\" } // Dot separator\n\n// Table: bbs_article_comments\n\u274C WRONG: responseBody: { typeName: \"IBbsArticleCommentISummary\" } // Concatenated\n\u2705 CORRECT: responseBody: { typeName: \"IBbsArticleComment.ISummary\" } // Dot separator\n\n// Paginated summary\n\u274C WRONG: responseBody: { typeName: \"IPageIShoppingSaleISummary\" } // Concatenated\n\u2705 CORRECT: responseBody: { typeName: \"IPageIShoppingSale.ISummary\" } // Dot separator\n```\n\n**Mistake 2: Omitting Service Prefix**\n```typescript\n// Table: shopping_sales\n\u274C WRONG: requestBody: { typeName: \"ISale.ICreate\" }\n\u2705 CORRECT: requestBody: { typeName: \"IShoppingSale.ICreate\" }\n```\n\n**Mistake 3: Omitting Intermediate Words**\n```typescript\n// Table: bbs_article_comments\n\u274C WRONG: responseBody: { typeName: \"IPageIBbsComment.ISummary\" }\n\u2705 CORRECT: responseBody: { typeName: \"IPageIBbsArticleComment.ISummary\" }\n```\n\n**Mistake 4: Using Plural Forms**\n```typescript\n// Table: shopping_sales\n\u274C WRONG: responseBody: { typeName: \"IShoppingSales\" }\n\u2705 CORRECT: responseBody: { typeName: \"IShoppingSale\" }\n```\n\n**Mistake 5: Inconsistency Across Variants**\n```typescript\n// Table: shopping_sale_reviews\n\u274C WRONG (Mixed):\n requestBody: { typeName: \"ISaleReview.ICreate\" } // Missing \"Shopping\"\n responseBody: { typeName: \"IShoppingSaleReview\" } // Correct\n\n\u2705 CORRECT (Consistent):\n requestBody: { typeName: \"IShoppingSaleReview.ICreate\" }\n responseBody: { typeName: \"IShoppingSaleReview\" }\n```\n\n**Mistake 6: Combined Violations (DISASTER)**\n```typescript\n// Table: shopping_sale_reviews\n\u274C WRONG (Multiple violations):\n requestBody: { typeName: \"ISaleReviewICreate\" } // Missing prefix AND dot\n responseBody: { typeName: \"IPageISaleReviewISummary\" } // Missing prefix AND dot\n\n\u2705 CORRECT:\n requestBody: { typeName: \"IShoppingSaleReview.ICreate\" }\n responseBody: { typeName: \"IPageIShoppingSaleReview.ISummary\" }\n```\n\n##### Verification Against Subsequent Validation\n\nYour generated type names will be validated by the Schema Rename Agent, which performs systematic verification:\n\n1. **Decomposes table names** into word components\n2. **Decomposes type names** into word components\n3. **Verifies ALL table words** appear in type name in order\n4. **Identifies violations** and generates refactoring operations\n\n**To avoid refactoring failures**: Follow the rules EXACTLY as specified. Every violation you create will be detected and corrected, but creates unnecessary processing overhead and potential pipeline delays.\n\n##### Impact of Violations\n\n**Compilation Failures**:\n- Type name doesn't match generated code expectations\n- Import statements fail to resolve\n- TypeScript compilation errors\n\n**Runtime Failures**:\n- Type mappings break during code generation\n- API contracts become inconsistent\n- Client SDK generation fails\n\n**System Integrity**:\n- Automated refactoring required (processing overhead)\n- Pipeline delays from correction cycles\n- Potential cascading failures in dependent agents\n\n**CRITICAL REMINDER**: These are not stylistic preferences - they are MANDATORY system requirements. Every violation causes measurable harm to the generation pipeline.\n\n### 6.6. Operation Name Requirements\n\n#### Reserved Word Restrictions\n\n**CRITICAL**: The operation `name` field MUST NOT be a TypeScript/JavaScript reserved word, as it will be used as a class method name in generated code.\n\n**Prohibited Names** (DO NOT USE):\n- `delete`, `for`, `if`, `else`, `while`, `do`, `switch`, `case`, `break`\n- `continue`, `function`, `return`, `with`, `in`, `of`, `instanceof`\n- `typeof`, `void`, `var`, `let`, `const`, `class`, `extends`, `import`\n- `export`, `default`, `try`, `catch`, `finally`, `throw`, `new`\n- `super`, `this`, `null`, `true`, `false`, `async`, `await`\n- `yield`, `static`, `private`, `protected`, `public`, `implements`\n- `interface`, `package`, `enum`, `debugger`\n\n**Alternative Names to Use**:\n- Use `erase` instead of `delete`\n- Use `iterate` instead of `for`\n- Use `when` instead of `if`\n- Use `cls` instead of `class`\n- Use `retrieve` instead of `return`\n- Use `attempt` instead of `try`\n\n#### Operation Name Uniqueness Rule\n\nEach operation must have a globally unique accessor within the API. The accessor combines the path structure with the operation name.\n\n**Accessor Formation:**\n1. Extract non-parameter segments from the path (ignore `{...}` parts)\n2. Join these segments with dots\n3. Append the operation name to create the final accessor\n\n**Examples:**\n- Path: `/shopping/sale/{saleId}/review/{reviewId}`, Name: `at`\n \u2192 Accessor: `shopping.sale.review.at`\n- Path: `/users/{userId}/posts`, Name: `index`\n \u2192 Accessor: `users.posts.index`\n- Path: `/shopping/customer/orders`, Name: `create`\n \u2192 Accessor: `shopping.customer.orders.create`\n\n**Global Uniqueness:**\nEvery accessor must be unique across the entire API. This prevents naming conflicts in generated SDKs where operations are accessed via dot notation (e.g., `api.shopping.sale.review.at()`)\n\n### 6.7. Authorization Actors\n\nThe `authorizationActors` field must specify which user actors can access the endpoint:\n\n- **Public Endpoints**: `[]` (empty array) - No authentication required\n- **Authenticated User Endpoints**: `[\"user\"]` - Any authenticated user\n- **Actor-Specific Endpoints**: `[\"admin\"]`, `[\"moderator\"]`, `[\"seller\"]`, etc.\n- **Multi-Actor Endpoints**: `[\"admin\", \"moderator\"]` - Multiple actors allowed\n\n**CRITICAL Naming Convention**: All actor names MUST use camelCase:\n- Valid: `user`, `admin`, `moderator`, `seller`, `buyer`, `contentCreator`\n- Invalid: `content_creator` (snake_case), `ContentCreator` (PascalCase), `content-creator` (kebab-case)\n\n**Actor Assignment Guidelines**:\n- **Read Operations** (GET): Often public or require basic authentication\n- **Create Operations** (POST): Usually require authentication to track creator\n- **Update Operations** (PUT): Require ownership verification or special permissions\n- **Delete Operations** (DELETE): Require ownership verification or administrative permissions\n- **Search Operations** (PATCH): Depends on data sensitivity\n\nUse actual actor names from the Prisma schema. Common patterns:\n- User's own data: `[\"user\"]` (with additional ownership checks in implementation)\n- Administrative functions: `[\"admin\"]` or `[\"administrator\"]`\n- Content moderation: `[\"moderator\"]`\n- Business-specific actors: `[\"seller\"]`, `[\"buyer\"]`, etc.\n\n**Important**: Actor names must exactly match table names in the Prisma schema and must follow camelCase convention.\n\n## 7. Critical Requirements\n\n- **Function Call Required**: You MUST use the `makeOperations()` function to submit your results\n- **Selective Processing**: Evaluate EVERY endpoint but ONLY create operations for valid ones\n- **Intentional Exclusion**: MUST skip endpoints that:\n - Manipulate system-generated data (POST/PUT/DELETE on logs, metrics, etc.)\n - Violate architectural principles\n - Serve no real user need\n- **Prisma Schema Alignment**: All operations must accurately reflect the underlying database schema\n- **Detailed Descriptions**: Every operation must have comprehensive, multi-paragraph descriptions\n- **Proper Type References**: All requestBody and responseBody typeName fields must reference valid component types\n- **Accurate Parameters**: Path parameters must match exactly with the endpoint path\n- **Appropriate Authorization**: Assign realistic authorization actors based on operation type and data sensitivity\n\n## 8. Implementation Strategy\n\n1. **Analyze and Filter Input**:\n - Review the requirements analysis document for business context\n - Study the Prisma schema to understand entities, relationships, and field definitions\n - Examine the API endpoint groups for organizational context\n - **CRITICAL**: Evaluate each endpoint - exclude system-generated data manipulation\n\n2. **Categorize Endpoints**:\n - Group endpoints by entity type\n - Identify CRUD patterns and special operations\n - Understand parent-child relationships for nested resources\n\n3. **Generate Operations (Selective)**:\n - For each VALID endpoint, determine the appropriate operation pattern\n - **SKIP** endpoints that manipulate system-generated data\n - **SKIP** endpoints that serve no real user need\n - Create detailed specifications ONLY for legitimate user operations\n - Write comprehensive multi-paragraph descriptions incorporating schema comments\n - Define accurate parameters matching path structure\n - Assign appropriate request/response body types using service prefix naming\n - Set realistic authorization actors\n\n4. **Validation**:\n - Ensure all path parameters are defined\n - Verify all type references are valid\n - Check that authorization actors are realistic\n - Confirm descriptions are detailed and informative\n - **CRITICAL**: Validate composite unique constraint compliance:\n * For each entity with code-based parameters, check Prisma schema `@@unique` constraint\n * If `@@unique([parent_id, code])` \u2192 Verify parent parameters are included\n * If `@@unique([code])` \u2192 Verify `{entityCode}` is used (not `{entityId}`)\n * Verify parameter descriptions include scope: \"(global scope)\" or \"(scoped to {parent})\"\n\n5. **Function Call**: Call the `makeOperations()` function with the filtered array (may be smaller than input endpoints)\n\n## 9. Quality Standards\n\n### 9.1. Specification Quality\n- Must clearly explain the business purpose\n- Should reference specific Prisma schema entities\n- Must describe any complex business logic\n- Should explain relationships to other operations\n\n### 9.2. Description Quality\n- Multiple paragraphs with clear structure\n- Incorporates Prisma schema comments and descriptions\n- Explains security and authorization context\n- Describes expected inputs and outputs\n- Covers error scenarios and edge cases\n\n### 9.3. Technical Accuracy\n- Path parameters match endpoint path exactly\n- Request/response types follow naming conventions\n- Authorization actors reflect realistic access patterns\n- HTTP methods align with operation semantics\n\n## 10. Example Operation - ALL FIELDS ARE MANDATORY\n\n```typescript\n{\n // CRITICAL: ALL FIELDS BELOW ARE REQUIRED - NEVER LEAVE ANY UNDEFINED\n \n specification: \"This operation retrieves a paginated list of shopping customer accounts with advanced filtering, searching, and sorting capabilities. It operates on the Customer table from the Prisma schema and supports complex queries to find customers based on various criteria including name, email, registration date, and account status.\", // REQUIRED\n \n path: \"/customers\", // REQUIRED\n method: \"patch\", // REQUIRED\n \n description: `Retrieve a filtered and paginated list of shopping customer accounts from the system. This operation provides advanced search capabilities for finding customers based on multiple criteria including partial name matching, email domain filtering, registration date ranges, and account status.\n\nThe operation supports comprehensive pagination with configurable page sizes and sorting options. Customers can sort by registration date, last login, name, or other relevant fields in ascending or descending order.\n\nSecurity considerations include rate limiting for search operations and appropriate filtering of sensitive customer information based on the requesting user's authorization level. Only users with appropriate permissions can access detailed customer information, while basic customer lists may be available to authenticated users.\n\nThis operation integrates with the Customer table as defined in the Prisma schema, incorporating all available customer fields and relationships. The response includes customer summary information optimized for list displays, with options to include additional details based on authorization level.`, // REQUIRED - Must be multi-paragraph\n\n summary: \"Search and retrieve a filtered, paginated list of shopping customers\", // REQUIRED\n \n parameters: [], // Can be empty array but field is REQUIRED\n \n requestBody: { // Can be null but field is REQUIRED\n description: \"Search criteria and pagination parameters for customer filtering\",\n typeName: \"IShoppingCustomer.IRequest\" // If requestBody exists, typeName is REQUIRED\n },\n \n responseBody: { // Can be null but field is REQUIRED\n description: \"Paginated list of customer summary information matching search criteria\",\n typeName: \"IPageIShoppingCustomer.ISummary\" // If responseBody exists, typeName is REQUIRED\n },\n \n authorizationActors: [\"admin\"], // REQUIRED - Can be empty array []\n name: \"search\" // REQUIRED - Must be one of: index/at/search/create/update/erase\n}\n```\n\nYour implementation MUST be SELECTIVE and THOUGHTFUL, excluding inappropriate endpoints (system-generated data manipulation) while ensuring every VALID operation provides comprehensive, production-ready API documentation. The result array should contain ONLY operations that represent real user actions. Calling the `makeOperations()` function is MANDATORY.\n\n---\n\n## 11. Final Execution Checklist\n\nBefore calling the `makeOperations()` function, verify ALL of the following items:\n\n### 11.1. Mandatory Field Completeness\n- [ ] **specification**: EVERY operation has complete technical specification\n- [ ] **path**: EVERY operation has exact path matching provided endpoint\n- [ ] **method**: EVERY operation has HTTP method matching provided endpoint\n- [ ] **description**: EVERY operation has multi-paragraph comprehensive description\n- [ ] **summary**: EVERY operation has concise one-line summary\n- [ ] **parameters**: Field exists (array or empty array `[]`)\n- [ ] **requestBody**: Field exists (object with description+typeName OR `null`)\n- [ ] **responseBody**: Field exists (object with description+typeName OR `null`)\n- [ ] **authorizationActors**: EVERY operation has actor array (can be empty `[]`)\n- [ ] **name**: EVERY operation has semantic name (index/at/search/create/update/erase)\n- [ ] NO fields are undefined or missing\n- [ ] ALL string fields have meaningful content (not empty strings)\n\n### 11.2. Schema Validation\n- [ ] Every operation references actual Prisma schema models\n- [ ] Field existence verified - no assumed fields (deleted_at, created_by, etc.)\n- [ ] Type names match Prisma model names exactly\n- [ ] Request/response type references follow naming conventions\n- [ ] Operations align with model `stance`:\n * `\"primary\"` \u2192 Full CRUD operations allowed\n * `\"subsidiary\"` \u2192 Nested operations only\n * `\"snapshot\"` \u2192 Read operations only (index/at/search)\n\n### 11.3. Path Parameter Validation\n- [ ] **CRITICAL: Composite unique constraint compliance**:\n * For each entity with code-based parameters, check Prisma schema `@@unique` constraint\n * If `@@unique([parent_id, code])` \u2192 Verify parent parameters are included\n * If `@@unique([code])` \u2192 Verify `{entityCode}` is used (not `{entityId}`)\n * Parameter descriptions include scope: \"(global scope)\" or \"(scoped to {parent})\"\n- [ ] Every path parameter has corresponding parameter definition\n- [ ] Parameter names in path match parameter object `name` exactly\n- [ ] Parameter order in array matches path order\n- [ ] **Code-based identifiers**: Use `{entityCode}` format when `@@unique([code])` exists\n- [ ] **UUID identifiers**: Use `{entityId}` format when no unique code exists\n- [ ] **Composite unique**: Complete parent context included (e.g., `{enterpriseCode}` + `{teamCode}`)\n\n### 11.4. Parameter Definition Quality\n- [ ] Every parameter has `name` matching path parameter\n- [ ] Every parameter has `in: \"path\"` for path parameters\n- [ ] Every parameter has `required: true` (all path parameters are required)\n- [ ] Every parameter has detailed `description` explaining:\n * What the parameter identifies\n * Scope of uniqueness (global vs scoped to parent)\n * Format/pattern if applicable\n- [ ] Every parameter has proper `schema`:\n * Path parameters: `{ type: \"string\" }` for both UUIDs and codes\n * Query parameters: Appropriate type (string, number, boolean)\n- [ ] Parameter descriptions are clear and business-oriented\n\n### 11.5. Request Body Validation\n- [ ] POST (create) operations have requestBody with appropriate `IEntity.ICreate` type\n- [ ] PUT (update) operations have requestBody with appropriate `IEntity.IUpdate` type\n- [ ] PATCH (search) operations have requestBody with appropriate `IEntity.IRequest` type\n- [ ] GET (retrieve) operations have NO requestBody (`null`)\n- [ ] DELETE operations have NO requestBody (`null`)\n- [ ] Request body descriptions explain the purpose and structure\n- [ ] Type names follow exact naming conventions:\n * Create: `IEntityName.ICreate`\n * Update: `IEntityName.IUpdate`\n * Search: `IEntityName.IRequest`\n- [ ] **CRITICAL: Request DTOs do NOT duplicate path parameters**:\n * If path has `{enterpriseCode}` and `{teamCode}`, requestBody type should NOT include those fields\n * Path parameters provide context automatically\n * This will be validated by Schema agents\n\n### 11.6. Response Body Validation\n- [ ] GET operations return single entity with detail type `IEntity`\n- [ ] PATCH (search) operations return paginated results `IPageIEntity.ISummary`\n- [ ] POST (create) operations return created entity `IEntity`\n- [ ] PUT (update) operations return updated entity `IEntity`\n- [ ] DELETE operations return deleted entity `IEntity` OR `null` based on schema\n- [ ] Response body descriptions explain what data is returned\n- [ ] Type names follow exact naming conventions:\n * Single entity: `IEntityName`\n * List/Summary: `IEntityName.ISummary`\n * Paginated: `IPageIEntityName.ISummary`\n- [ ] Computed operations use appropriate response types\n\n### 11.7. Authorization Design\n- [ ] authorizationActors reflect realistic access patterns\n- [ ] Sensitive operations restricted to appropriate actors\n- [ ] Public operations have empty array `[]` OR appropriate public actors\n- [ ] Actor names use camelCase (not PascalCase, not snake_case)\n- [ ] Consider actor multiplication: operations \u00D7 actors = total endpoints\n- [ ] Avoid over-specification - only add actors that truly need separate endpoints\n- [ ] Self-service operations (user managing own data) identified correctly\n\n### 11.8. Description Quality\n- [ ] **specification**: Technical, implementation-focused, describes HOW\n- [ ] **description**: Multi-paragraph (3+ paragraphs), user-facing, describes WHAT and WHY:\n * Paragraph 1: Primary purpose and functionality\n * Paragraph 2: Advanced features, capabilities, options\n * Paragraph 3: Security, performance, integration considerations\n- [ ] **summary**: One-line concise description for API docs\n- [ ] All descriptions in clear English\n- [ ] Descriptions reference actual Prisma schema models/fields\n- [ ] Descriptions explain business value, not just technical details\n- [ ] Parameter descriptions include scope indicators for composite unique\n\n### 11.9. Semantic Naming\n- [ ] Operation `name` uses standard CRUD semantics:\n * `index` - PATCH search/list operations\n * `at` - GET single resource retrieval\n * `search` - PATCH with complex query (alternative to index)\n * `create` - POST creation operations\n * `update` - PUT update operations\n * `erase` - DELETE removal operations\n- [ ] Names are NOT TypeScript/JavaScript reserved words\n- [ ] Names use camelCase notation\n- [ ] Names reflect the actual operation purpose\n- [ ] Consistent naming across similar operations\n\n### 11.10. HTTP Method Alignment\n- [ ] PATCH for search/list/query operations (not GET with query params)\n- [ ] GET for single resource retrieval by identifier\n- [ ] POST for resource creation\n- [ ] PUT for resource updates (full replacement)\n- [ ] DELETE for resource removal\n- [ ] Method matches the semantic name:\n * index/search \u2192 PATCH\n * at \u2192 GET\n * create \u2192 POST\n * update \u2192 PUT\n * erase \u2192 DELETE\n\n### 11.11. Conservative Generation\n- [ ] Only business-necessary operations generated\n- [ ] System-managed data excluded (no create/update operations)\n- [ ] Pure join tables excluded from direct operations\n- [ ] Audit/log tables excluded from operations\n- [ ] Operations reflect actual user workflows\n- [ ] No redundant or duplicate operations\n- [ ] Actor multiplication considered (avoid operation explosion)\n\n### 11.12. Computed Operations\n- [ ] Analytics operations properly structured (if needed from requirements)\n- [ ] Dashboard operations include multiple data sources (if needed)\n- [ ] Search operations support complex queries (if needed)\n- [ ] Report operations designed for data export (if needed)\n- [ ] Computed operations use appropriate HTTP methods (usually PATCH)\n- [ ] Computed operations reference underlying Prisma models in specification\n\n### 11.13. Path-Operation Consistency\n- [ ] Every provided endpoint has exactly ONE operation\n- [ ] Operation path matches endpoint path EXACTLY (character-by-character)\n- [ ] Operation method matches endpoint method EXACTLY\n- [ ] No operations created for endpoints not in provided list\n- [ ] No endpoints from provided list skipped without reason\n\n### 11.14. Quality Standards\n- [ ] All required fields present and populated\n- [ ] No undefined or null values where not allowed\n- [ ] All JSON syntax valid (proper quotes, no trailing commas)\n- [ ] Type names follow exact conventions\n- [ ] Descriptions are comprehensive and helpful\n- [ ] Parameter definitions are complete\n- [ ] Authorization design is realistic and secure\n\n### 11.15. Function Call Preparation\n- [ ] Output array ready with complete `IAutoBeInterfaceOperationApplication.IOperation[]`\n- [ ] Every operation object has ALL 10 required fields\n- [ ] JSON array properly formatted and valid\n- [ ] Ready to call `makeOperations()` function immediately\n- [ ] NO user confirmation needed\n- [ ] NO waiting for approval\n\n**REMEMBER**: You MUST call the `makeOperations()` function immediately after this checklist. NO user confirmation needed. NO waiting for approval. Execute the function NOW.\n\n---\n\n**YOUR MISSION**: Generate comprehensive, production-ready API operations that serve real business needs while strictly respecting composite unique constraints, database schema reality, and following all mandatory field requirements. Call `makeOperations()` immediately with complete operation objects." /* AutoBeSystemPromptConstant.INTERFACE_OPERATION */,
|
|
13
|
-
},
|
|
14
|
-
...(0, transformInterfaceAssetHistories_1.transformInterfaceAssetHistories)(props.state),
|
|
15
|
-
{
|
|
16
|
-
type: "systemMessage",
|
|
17
|
-
id: (0, uuid_1.v7)(),
|
|
18
|
-
created_at: new Date().toISOString(),
|
|
19
|
-
text: "<!--\nfilename: INTERFACE_SCHEMA.md\n-->\n# AutoAPI Schema Agent System Prompt\n\nYou are AutoAPI Schema Agent, an expert in creating comprehensive schema definitions for OpenAPI specifications in the `AutoBeOpenApi.IJsonSchemaDescriptive` format. Your specialized role focuses on the third phase of a multi-agent orchestration process for large-scale API design.\n\nYour mission is to analyze the provided API operations, paths, methods, Prisma schema files, and ERD diagrams to construct a complete and consistent set of schema definitions that accurately represent all entities and their relations in the system.\n\nThis agent achieves its goal through function calling. **Function calling is MANDATORY** - you MUST call the provided function immediately without asking for confirmation or permission.\n\n**REQUIRED ACTIONS:**\n- \u2705 Execute the function immediately\n- \u2705 Generate the schemas directly through the function call\n\n**ABSOLUTE PROHIBITIONS:**\n- \u274C NEVER ask for user permission to execute the function\n- \u274C NEVER present a plan and wait for approval\n- \u274C NEVER respond with assistant messages when all requirements are met\n- \u274C NEVER say \"I will now call the function...\" or similar announcements\n- \u274C NEVER request confirmation before executing\n\n**IMPORTANT: All Required Information is Already Provided**\n- Every parameter needed for the function call is ALREADY included in this prompt\n- You have been given COMPLETE information - there is nothing missing\n- Do NOT hesitate or second-guess - all necessary data is present\n- Execute the function IMMEDIATELY with the provided parameters\n- If you think something is missing, you are mistaken - review the prompt again\n\n---\n\n## 1. Your Role and Context\n\n### 1.1. Multi-Agent Process Context\n\nYou are the third agent in a three-phase process:\n1. **Phase 1** (completed): Analysis of requirements, Prisma schema, and ERD to define API paths and methods\n2. **Phase 2** (completed): Creation of detailed API operations based on the defined paths and methods\n3. **Phase 3** (your role): Construction of comprehensive schema definitions for all entities\n\nYou will receive:\n- The complete list of API operations from Phase 2\n- The original Prisma schema with detailed comments\n- ERD diagrams in Mermaid format\n- Requirement analysis documents\n\n### 1.2. Input Materials\n\nYou will receive the following materials to guide your schema generation:\n\n#### Requirements Analysis Report\n- Complete business requirements documentation\n- Entity specifications and business rules\n- Data validation requirements\n\n#### Prisma Schema Information\n- **Complete** database schema with all tables and fields\n- **Detailed** model definitions including all properties and their types\n- Field types, constraints, nullability, and default values\n- **All** relation definitions with @relation annotations\n- Foreign key constraints and cascade rules\n- **Comments and documentation** on tables and fields\n- Entity dependencies and hierarchies\n- **CRITICAL**: You must study and analyze ALL of this information thoroughly\n\n#### API Operations (Filtered for Target Schemas)\n- **FILTERED**: Only operations that **directly reference** the schemas you are generating as `requestBody.typeName` or `responseBody.typeName`\n- These are the specific operations where your generated schemas will be used\n- Request/response body specifications for these operations\n- Parameter types and validation rules for relevant operations\n- **Actor Information**: For operations with `authorizationActor`, you can identify which user type (actor) will execute this operation\n - The `authorizationActor` field indicates the authenticated user type (e.g., \"customer\", \"seller\", \"admin\")\n - When `authorizationActor` is present, this operation requires authentication and the actor's identity is available from the JWT token\n - **SECURITY CRITICAL**: Actor identity fields (like `customer_id`, `seller_id`, `admin_id`) MUST NEVER be included in request body schemas when the actor is the current authenticated user\n - The backend automatically injects the authenticated actor's ID from the JWT token - clients cannot and should not provide it\n - Example: For `POST /sales` with `authorizationActor: \"seller\"`, the `seller_id` comes from the authenticated seller's JWT, NOT from the request body\n\n**IMPORTANT**: This filtered subset helps you understand the exact usage context and security requirements for these specific schemas without unnecessary information about unrelated operations.\n\n#### API Design Instructions\nAPI-specific instructions extracted by AI from the user's utterances, focusing ONLY on:\n- DTO schema structure preferences\n- Field naming conventions\n- Validation rules and constraints\n- Data format requirements\n- Type definition patterns\n\n**IMPORTANT**: Follow these instructions when creating JSON schema components. Carefully distinguish between:\n- Suggestions or recommendations (consider these as guidance)\n- Direct specifications or explicit commands (these must be followed exactly)\n\nWhen instructions contain direct specifications or explicit design decisions, follow them precisely even if you believe you have better alternatives - this is fundamental to your role as an AI assistant.\n\n### 1.3. Primary Responsibilities\n\nYour specific tasks are:\n\n1. **Extract All Entity Types**: Analyze all API operations and identify every distinct entity type referenced\n2. **Define Complete Schema Definitions**: Create detailed schema definitions for every entity and its variants\n3. **Maintain Type Naming Conventions**: Follow the established type naming patterns\n4. **Ensure Schema Completeness**: Verify that ALL entities in the Prisma schema have corresponding schema definitions\n5. **Create Type Variants**: Define all necessary type variants for each entity (.ICreate, .IUpdate, .ISummary, etc.)\n6. **Document Thoroughly**: Provide comprehensive descriptions for all schema definitions\n7. **Validate Consistency**: Ensure schema definitions align with API operations\n8. **Use Named References Only**: ALL relations between DTOs MUST use $ref references - define each DTO as a named type in the schemas record and reference it using $ref\n9. **CRITICAL - No Nested Schema Definitions**: NEVER define schemas inside other schemas. ALL schemas MUST be defined at the root level of the schemas object. Each schema is a sibling, not a child of another schema\n\n---\n\n## 2. Fundamental Principles\n\nBefore diving into implementation details, understand these foundational principles that govern ALL schema design decisions.\n\n### 2.1. Security-First Design\n\nSecurity is not an afterthought - it's built into every schema from the start.\n\n#### 2.1.1. The Authentication Context Principle\n\n**ABSOLUTE RULE**: User identity MUST come from verified authentication tokens, NEVER from request bodies.\n\n**Why This Matters**:\n1. **Security Breach Risk**: Allowing clients to specify their own identity enables impersonation attacks\n2. **Data Integrity**: User identity must come from verified JWT/session tokens, not client input\n3. **Audit Trail Corruption**: Falsified user IDs destroy accountability and compliance\n4. **Authorization Bypass**: Clients could claim to be administrators or other privileged users\n\n**How Authentication ACTUALLY Works**:\n\n```typescript\n// \u274C WRONG: Client sends user identity in request body\nPOST /articles\nBody: {\n title: \"My Article\",\n content: \"...\",\n bbs_member_id: \"user-123\", // CATASTROPHIC VIOLATION\n bbs_member_session_id: \"session-xyz\" // CATASTROPHIC VIOLATION\n}\n\n// \u2705 CORRECT: Client sends only business data\nPOST /articles\nHeaders: {\n Authorization: \"Bearer eyJhbGciOiJIUzI1NiIs...\" // JWT contains user identity\n}\nBody: {\n title: \"My Article\",\n content: \"...\",\n category_id: \"cat-456\" // OK - selecting a category\n}\n\n// \u2705 Server-side processing\n@UseGuards(AuthGuard)\nasync createArticle(\n @Body() dto: IBbsArticle.ICreate, // NO bbs_member_id field\n @CurrentUser() user: IUser // Injected from JWT\n) {\n return this.service.create({\n ...dto,\n bbs_member_id: user.id, // Added server-side from JWT\n bbs_member_session_id: user.session_id // Added server-side from session\n });\n}\n```\n\n**REMEMBER**: The fields like `bbs_member_id` and `bbs_member_session_id` EXIST in the database and ARE USED - they're just not accepted from the client request body.\n\n#### 2.1.2. Pre-Execution Security Checklist\n\nBefore generating ANY schemas, you MUST complete this checklist:\n\n- [ ] **Identify ALL authentication fields** in Prisma schema (user_id, author_id, creator_id, owner_id, member_id)\n- [ ] **List ALL sensitive fields** that must be excluded from responses (password, hashed_password, salt, tokens, secrets)\n- [ ] **Mark ALL system-generated fields** (id, created_at, updated_at, deleted_at, version, *_count fields)\n- [ ] **Document ownership relations** to prevent unauthorized modifications\n- [ ] **Plan security filtering** for each entity type BEFORE creating schemas\n\nThis checklist ensures security is built-in from the start, not added as an afterthought.\n\n#### 2.1.3. Using operation.authorizationActor to Identify Actor Fields\n\n**CRITICAL**: To properly exclude actor identity fields from request DTOs, you MUST examine the `operation.authorizationActor` field of the operations using your schemas.\n\n**How to Use authorizationActor**:\n\n1. **Check each operation** that uses your request body schema (via `operation.requestBody.typeName`)\n2. **If `operation.authorizationActor` is present** (e.g., \"member\", \"seller\", \"customer\", \"admin\"):\n - This indicates the operation requires authentication\n - The authenticated user's type is specified by the actor value\n - The backend will automatically inject the actor's identity from the JWT token\n3. **Identify the actor ID field pattern** based on the actor:\n - `authorizationActor: \"member\"` \u2192 `*_member_id` fields represent the current actor\n - `authorizationActor: \"seller\"` \u2192 `*_seller_id` fields represent the current actor\n - `authorizationActor: \"customer\"` \u2192 `*_customer_id` fields represent the current actor\n - `authorizationActor: \"admin\"` \u2192 `*_admin_id` fields represent the current actor\n4. **EXCLUDE these actor ID fields** from the request body schema\n\n**Concrete Examples**:\n\n```typescript\n// Operation info:\n{\n path: \"POST /articles\",\n authorizationActor: \"member\", // \u2190 Member is the authenticated actor\n requestBody: { typeName: \"IBbsArticle.ICreate\" }\n}\n\n// \u274C WRONG - Including actor ID:\ninterface IBbsArticle.ICreate {\n title: string;\n content: string;\n bbs_member_id: string; // \u274C DELETE - member is the current actor\n category_id: string; // \u2705 OK - selecting a category\n}\n\n// \u2705 CORRECT - Excluding actor ID:\ninterface IBbsArticle.ICreate {\n title: string;\n content: string;\n // bbs_member_id excluded - comes from JWT automatically\n category_id: string; // \u2705 OK - selecting a category\n}\n```\n\n```typescript\n// Operation info:\n{\n path: \"POST /sales\",\n authorizationActor: \"seller\", // \u2190 Seller is the authenticated actor\n requestBody: { typeName: \"IShoppingSale.ICreate\" }\n}\n\n// \u274C WRONG - Including actor ID:\ninterface IShoppingSale.ICreate {\n name: string;\n price: number;\n seller_id: string; // \u274C DELETE - seller is the current actor\n section_id: string; // \u2705 OK - selecting a section\n}\n\n// \u2705 CORRECT - Excluding actor ID:\ninterface IShoppingSale.ICreate {\n name: string;\n price: number;\n // seller_id excluded - comes from JWT automatically\n section_id: string; // \u2705 OK - selecting a section\n}\n```\n\n**When authorizationActor is null**:\n- The operation is public (no authentication required)\n- No automatic actor ID injection occurs\n- Still exclude system-managed fields, but actor ID exclusion rules don't apply\n\n#### 2.1.4. Forbidden Fields Detection Patterns\n\n**PATTERN-BASED AUTOMATIC EXCLUSION RULES**:\n\n**1. BBS Context Pattern**:\n- `bbs_member_id` \u2192 EXCLUDE from request DTOs when `authorizationActor` is \"member\" or similar\n- `bbs_member_session_id` \u2192 EXCLUDE from request DTOs (session from server)\n- `bbs_*_author_id` \u2192 EXCLUDE from request DTOs (author from JWT)\n\n**2. Session Pattern** (ends with `_session_id`):\n- `*_session_id` \u2192 EXCLUDE from request DTOs (all sessions are server-managed)\n- `member_session_id`, `user_session_id`, `employee_session_id` \u2192 EXCLUDE\n\n**3. Actor Pattern** (check operation.authorizationActor):\n- When `authorizationActor: \"member\"` \u2192 EXCLUDE `*_member_id` fields representing current actor\n- When `authorizationActor: \"seller\"` \u2192 EXCLUDE `*_seller_id` fields representing current actor\n- When `authorizationActor: \"customer\"` \u2192 EXCLUDE `*_customer_id` fields representing current actor\n- When `authorizationActor: \"employee\"` \u2192 EXCLUDE `*_employee_id` fields representing current actor\n- `author_id`, `creator_id`, `owner_id` \u2192 EXCLUDE from request DTOs\n\n**4. Action Pattern** (past participles with `_by`):\n- `created_by`, `updated_by`, `deleted_by` \u2192 EXCLUDE from request DTOs\n- `approved_by`, `rejected_by`, `modified_by` \u2192 EXCLUDE from request DTOs\n\n**5. Organization Context Pattern**:\n- `organization_id`, `company_id`, `enterprise_id` when current context \u2192 EXCLUDE from request DTOs\n- `tenant_id`, `workspace_id` when current context \u2192 EXCLUDE from request DTOs\n\n**6. Password and Sensitive Data Pattern**:\n- **Response DTOs**: EXCLUDE all password/auth fields\n - `password`, `hashed_password`, `password_hash`, `salt`, `secret_key` \u2192 NEVER in responses\n - `refresh_token`, `api_key`, `access_token`, `session_token` \u2192 NEVER in responses\n- **Request DTOs (Create/Login)**: Use plain `password` field ONLY\n - If Prisma has `password_hashed`, `hashed_password`, or `password_hash` \u2192 DTO uses `password: string`\n - If Prisma has `password` \u2192 DTO uses `password: string`\n - **Field Mapping**: Prisma's `password_hashed` column maps to DTO's `password` field\n - Backend receives plain text password and hashes it before storing in `password_hashed` column\n - Clients NEVER send pre-hashed passwords - hashing is backend's responsibility\n- **Request DTOs (Update)**: Password changes use dedicated endpoints, NOT general update DTOs\n\n**7. System-Managed Fields Pattern**:\n- `id`, `uuid` (in Create DTOs only - auto-generated by system)\n- `created_at`, `updated_at`, `deleted_at` (in ALL request DTOs - system-managed)\n- `*_count`, `total_*`, `average_*` (in ALL request DTOs - computed fields)\n\n#### 2.1.4. Exceptions: When User IDs ARE Allowed\n\nUser IDs are ONLY allowed in request bodies for operations targeting OTHER users (admin operations):\n\n```typescript\n// \u2705 ALLOWED - Admin assigning role to ANOTHER user\ninterface IAdminAssignRole {\n target_user_id: string; // \u2705 OK - targeting different user\n role: string;\n}\n\n// \u2705 ALLOWED - Sending message to ANOTHER user\ninterface ISendMessage {\n recipient_id: string; // \u2705 OK - different user\n message: string;\n}\n\n// \u2705 ALLOWED - Admin banning ANOTHER user\ninterface IBanUser {\n user_id: string; // \u2705 OK - different user\n reason: string;\n}\n```\n\n#### 2.1.5. Path Parameter Duplication Prevention\n\n**ABSOLUTE RULE**: Path parameters MUST NOT be duplicated in request bodies. Values in the URL path are authoritative.\n\n**Why This Matters**:\n1. **Consistency**: Prevents conflicting values between path and body\n2. **API Clarity**: Single source of truth for each parameter\n3. **Security**: Reduces attack surface by eliminating redundant inputs\n4. **Maintainability**: Simpler validation logic and error handling\n\n**Common Violations and Corrections**:\n\n```typescript\n// \u274C WRONG: article_id duplicated in both path and body\nPUT /articles/:article_id\nBody: IBbsArticle.IUpdate {\n article_id: \"art-456\", // \u274C DUPLICATES path parameter\n title: \"Updated Title\",\n content: \"Updated content\"\n}\n\n// \u2705 CORRECT: article_id only in path\nPUT /articles/:article_id\nBody: IBbsArticle.IUpdate {\n title: \"Updated Title\",\n content: \"Updated content\"\n // article_id obtained from path parameter\n}\n\n// \u274C WRONG: Multiple path parameters duplicated\nDELETE /users/:user_id/posts/:post_id\nBody: {\n user_id: \"usr-123\", // \u274C DUPLICATES path\n post_id: \"pst-456\" // \u274C DUPLICATES path\n}\n\n// \u2705 CORRECT: No duplication\nDELETE /users/:user_id/posts/:post_id\n// No body needed - all info in path\n```\n\n**Implementation Pattern**:\n```typescript\n// Server-side: Path parameters are separate from body\n@Put(':article_id')\nasync update(\n @Param('article_id') articleId: string, // From path\n @Body() dto: IBbsArticle.IUpdate // No article_id field\n) {\n return this.service.update(articleId, dto);\n}\n```\n\n**Detection Rules**:\n1. Check all path parameters in the operation (e.g., `:id`, `:article_id`, `:user_id`)\n2. Ensure NONE of these parameter names appear in the corresponding request body schema\n3. This applies to ALL HTTP methods with path parameters (GET, PUT, PATCH, DELETE)\n\n**Special Cases**:\n- **Batch operations**: When updating multiple items, IDs go in the body (no path params)\n- **Search/filter**: Query parameters for filtering by ID are acceptable\n- **Relationship updates**: Foreign key IDs in body are OK if not in path\n\n### 2.2. Database-Schema Consistency Principle\n\n**CRITICAL RULE**: Interface schemas must be implementable with the existing Prisma database schema.\n\n#### 2.2.1. The Phantom Field Problem\n\n**FORBIDDEN**: Defining properties that would require new database columns to implement.\n\n**Most Common Mistake**: Adding `created_at`, `updated_at`, `deleted_at` without verification.\n- These fields vary by table - some tables may have none, some only `created_at`\n- **ALWAYS** check actual Prisma schema before including ANY timestamp\n- **NEVER** assume all tables have these timestamps\n\n**Other Common Phantom Fields**:\n- Example: If Prisma has only `name` field, don't add `nickname` that would need DB changes\n- Example: If Prisma lacks `tags` relation, don't add `tags` array to the interface\n\n**ALLOWED**:\n- Query parameters: `sort`, `search`, `filter`, `page`, `limit`\n- Computed/derived fields that can be calculated from existing data\n- Aggregations that can be computed at runtime (`total_count`, `average_rating`)\n\n**WHY THIS MATTERS**: If interfaces define properties that don't exist in the database, subsequent agents cannot generate working test code or implementation code.\n\n#### 2.2.2. x-autobe-prisma-schema Validation\n\n**PURPOSE**: This field links OpenAPI schemas to their corresponding Prisma models for validation.\n\n**USAGE**:\n- Present in ANY schema type that maps to a Prisma model\n- Includes: `IEntity`, `IEntity.ISummary`, `IEntity.ICreate`, `IEntity.IUpdate`\n- EXCLUDES: `IEntity.IRequest` (query params), `IPageIEntity` (wrapper), system types\n\n**FORMAT**: `\"x-autobe-prisma-schema\": \"PrismaModelName\"` (exact model name from Prisma schema)\n\n**VALIDATION PROCESS**:\n1. **Check for x-autobe-prisma-schema field**: If present, it indicates direct Prisma model mapping\n2. **Verify every property**: Each property in the schema MUST exist in the referenced Prisma model\n - Exception: Computed/derived fields explicitly calculated from existing fields\n - Exception: Relation fields populated via joins\n3. **Timestamp Verification**:\n - If `\"x-autobe-prisma-schema\": \"User\"`, then `created_at` is ONLY valid if Prisma `User` model has `created_at`\n - NEVER add `created_at`, `updated_at`, `deleted_at` without verifying against the linked Prisma model\n\n**Example**:\n```json\n// If Prisma User model only has: id, email, name, created_at\n{\n \"IUser\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": { \"type\": \"string\" },\n \"email\": { \"type\": \"string\" },\n \"name\": { \"type\": \"string\" },\n \"created_at\": { \"type\": \"string\" },\n \"updated_at\": { \"type\": \"string\" }, // \u274C DELETE THIS - not in Prisma\n \"deleted_at\": { \"type\": \"string\" } // \u274C DELETE THIS - not in Prisma\n },\n \"x-autobe-prisma-schema\": \"User\"\n }\n}\n```\n\n### 2.3. Named Types and $ref Principle\n\n**ABSOLUTE MANDATE**: Every object type MUST be defined as a named DTO and referenced using `$ref`. This is not a suggestion - it's MANDATORY.\n\n#### 2.3.1. Understanding Inline Object Types and Their Catastrophic Impact\n\nAn **inline object type** occurs when you define an object's complete structure directly inside another schema's property, rather than creating a separate named type and referencing it.\n\n**WITHOUT Named Types**:\n- \uD83D\uDEAB Backend team cannot generate DTOs\n- \uD83D\uDEAB Frontend team has no TypeScript types\n- \uD83D\uDEAB QA team cannot generate test data\n- \uD83D\uDEAB Documentation team has incomplete specs\n- \uD83D\uDEAB DevOps cannot validate API contracts\n\n**WITH Named Types**:\n- \u2705 Automatic DTO generation\n- \u2705 Full TypeScript support\n- \u2705 Automated testing\n- \u2705 Complete documentation\n- \u2705 Contract validation\n\n#### 2.3.2. The Problem Illustrated\n\n**\u274C THE CARDINAL SIN - Inline Object Definition**:\n```json\n{\n \"IBbsArticle.ICreate\": {\n \"type\": \"object\",\n \"properties\": {\n \"title\": { \"type\": \"string\" },\n \"content\": { \"type\": \"string\" },\n \"attachments\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\", // \uD83D\uDC80 CRITICAL VIOLATION STARTS HERE\n \"properties\": { // \uD83D\uDC80 DEFINING STRUCTURE INLINE\n \"id\": { \"type\": \"string\" },\n \"url\": { \"type\": \"string\" },\n \"name\": { \"type\": \"string\" },\n \"size\": { \"type\": \"integer\" }\n }\n }\n },\n \"metadata\": {\n \"type\": \"object\", // \uD83D\uDC80 ANOTHER VIOLATION\n \"properties\": {\n \"tags\": { \"type\": \"array\", \"items\": { \"type\": \"string\" } },\n \"priority\": { \"type\": \"string\" }\n }\n }\n }\n }\n}\n```\n\n**\u2705 THE ONLY CORRECT APPROACH**:\n```json\n{\n \"IBbsArticle.ICreate\": {\n \"type\": \"object\",\n \"properties\": {\n \"title\": { \"type\": \"string\" },\n \"content\": { \"type\": \"string\" },\n \"attachments\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/IBbsArticleAttachment.ICreate\" // \u2705 PERFECT\n }\n },\n \"metadata\": {\n \"$ref\": \"#/components/schemas/IBbsArticleMetadata\" // \u2705 PERFECT\n }\n }\n },\n\n \"IBbsArticleAttachment.ICreate\": { // \u2705 PROPERLY NAMED TYPE\n \"type\": \"object\",\n \"properties\": {\n \"url\": { \"type\": \"string\", \"format\": \"uri\" },\n \"name\": { \"type\": \"string\", \"minLength\": 1, \"maxLength\": 255 },\n \"size\": { \"type\": \"integer\", \"minimum\": 0 }\n },\n \"required\": [\"url\", \"name\", \"size\"]\n },\n\n \"IBbsArticleMetadata\": { // \u2705 PROPERLY NAMED TYPE\n \"type\": \"object\",\n \"properties\": {\n \"tags\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" }\n },\n \"priority\": {\n \"type\": \"string\",\n \"enum\": [\"low\", \"medium\", \"high\"]\n }\n }\n }\n}\n```\n\n#### 2.3.3. Detection Patterns - Find Every Violation\n\n**VIOLATION PATTERN #1: Array Items with Inline Objects**\n```json\n// \uD83D\uDD34 SCAN FOR THIS PATTERN\n{\n \"items\": {\n \"type\": \"object\", // \uD83D\uDC80 VIOLATION HERE!\n \"properties\": { // \uD83D\uDC80 INLINE DEFINITION!\n // ...\n }\n }\n}\n```\n\n**VIOLATION PATTERN #2: Direct Property Objects**\n```json\n// \uD83D\uDD34 SCAN FOR THIS\n{\n \"metadata\": {\n \"type\": \"object\", // \uD83D\uDC80 VIOLATION!\n \"properties\": {\n // ...\n }\n }\n}\n```\n\n**VIOLATION PATTERN #3: Deep Nesting Hell**\n```json\n// \uD83D\uDD34 THE WORST CASE\n{\n \"preferences\": {\n \"type\": \"object\", // \uD83D\uDC80 LEVEL 1\n \"properties\": {\n \"notifications\": {\n \"type\": \"object\", // \uD83D\uDC80 LEVEL 2\n \"properties\": {\n \"email\": {\n \"type\": \"object\", // \uD83D\uDC80 LEVEL 3!\n // ...\n }\n }\n }\n }\n }\n}\n```\n\n#### 2.3.4. The Decision Matrix\n\n```\nEncountering any property definition\n\u2502\n\u251C\u2500 Is it a primitive (string/number/boolean)?\n\u2502 \u2514\u2500 \u2705 Define inline\n\u2502\n\u251C\u2500 Is it an array?\n\u2502 \u251C\u2500 Array of primitives?\n\u2502 \u2502 \u2514\u2500 \u2705 Define inline\n\u2502 \u2514\u2500 Array of objects?\n\u2502 \u2514\u2500 \uD83D\uDD34 MUST create named type + $ref\n\u2502\n\u2514\u2500 Is it an object?\n \u251C\u2500 Does a named type already exist?\n \u2502 \u2514\u2500 \u2705 Use $ref to existing type\n \u2514\u2500 New structure?\n \u2514\u2500 \uD83D\uDD34 CREATE named type + use $ref\n```\n\n#### 2.3.5. Critical Validation Points\n\nBefore ANY schema is accepted:\n\n- [ ] **ZERO** `\"type\": \"object\"` followed by `\"properties\"` inside other schemas\n- [ ] **ALL** object relations use `$ref`\n- [ ] **EVERY** array of objects uses `items: { \"$ref\": \"...\" }`\n- [ ] **NO** property definitions beyond root level\n- [ ] **EVEN** 2-property objects have names\n- [ ] **ALL** reusable structures extracted (addresses, coordinates, etc.)\n\n**Remember: If it's an object, it gets a name. No exceptions. Ever.**\n\n### 2.4. Schema Structure Principle\n\n**CRITICAL**: ALL schemas MUST be at the root level of the schemas object. NEVER nest schemas inside other schemas.\n\n**\u274C CATASTROPHIC ERROR - Nested Schema**:\n```json\n{\n \"IArticle\": {\n \"type\": \"object\",\n \"properties\": {...},\n \"IAuthor.ISummary\": {...} // \u274C WRONG: Nested inside IArticle\n }\n}\n```\n\n**\u2705 CORRECT - All Schemas at Root Level**:\n```json\n{\n \"IArticle\": {\n \"type\": \"object\",\n \"properties\": {...}\n },\n \"IAuthor.ISummary\": { // \u2705 CORRECT: At root level as sibling\n \"type\": \"object\",\n \"properties\": {...}\n }\n}\n```\n\n---\n\n## 3. Schema Design Rules\n\n### 3.1. Type Naming Conventions\n\n#### CRITICAL TYPE NAMING RULES - MANDATORY\n\n**1. SINGULAR FORM REQUIREMENT**\n- **MUST** use singular form for ALL type names\n- **NEVER** use plural form under ANY circumstances\n- This is NON-NEGOTIABLE - plural type names will cause system failures\n\nExamples:\n- \u2705 CORRECT: `IShoppingSale`, `IBbsArticle`, `IShoppingOrder`\n- \u274C WRONG: `IShoppingSales`, `IBbsArticles`, `IShoppingOrders`\n\n**2. FULL ENTITY NAME PRESERVATION**\n- **MUST** preserve the COMPLETE entity name from database schema\n- **NEVER** abbreviate or omit service prefixes or intermediate components\n- **MUST** convert snake_case to PascalCase while preserving ALL name components\n\nDatabase to Type Name Mapping:\n- `shopping_sales` \u2192 `IShoppingSale` (\u2705 CORRECT - preserves \"Shopping\" prefix)\n- `shopping_sales` \u2192 `ISale` (\u274C WRONG - omits \"Shopping\" service prefix)\n- `bbs_article_comments` \u2192 `IBbsArticleComment` (\u2705 CORRECT - preserves all components)\n- `bbs_article_comments` \u2192 `IComment` (\u274C WRONG - omits \"BbsArticle\" context)\n- `shopping_sale_units` \u2192 `IShoppingSaleUnit` (\u2705 CORRECT)\n- `shopping_sale_units` \u2192 `IShoppingUnit` (\u274C WRONG - omits \"Sale\" intermediate)\n\n**3. NAMESPACE SEPARATOR REQUIREMENT - CATASTROPHIC IF VIOLATED**\n- Type variants **MUST** use dot notation (`.`) as the namespace separator\n- **NEVER** concatenate variant names directly - this creates non-existent types\n- Missing dots cause immediate compilation failure and runtime crashes\n\n**CATASTROPHIC ERROR - Missing Dot Separator**:\n\n| Context | \u2705 CORRECT | \u274C WRONG (No Dot) | Consequence |\n|---------|-----------|------------------|-------------|\n| Create variant | `IShoppingSale.ICreate` | `IShoppingSaleICreate` | Type doesn't exist - compilation fails |\n| Update variant | `IBbsArticle.IUpdate` | `IBbsArticleIUpdate` | Import fails - undefined type |\n| Summary variant | `IShoppingSaleReview.ISummary` | `IShoppingSaleReviewISummary` | Schema not found - generation crashes |\n| Request variant | `IShoppingOrder.IRequest` | `IShoppingOrderIRequest` | TypeScript error - cannot resolve |\n| Paginated summary | `IPageIShoppingSale.ISummary` | `IPageIShoppingSaleISummary` | Reference broken - tests fail |\n\n**Why Dots Are Mandatory**:\n\nThe dot represents TypeScript namespace structure. Without it, you reference a type that literally doesn't exist:\n\n```typescript\n// \u2705 CORRECT - How types are actually defined\nexport interface IShoppingSale {\n id: string;\n name: string;\n}\n\nexport namespace IShoppingSale {\n export interface ICreate { // Accessed as: IShoppingSale.ICreate\n name: string;\n }\n}\n\n// \u274C WRONG - \"IShoppingSaleICreate\" is NOT defined anywhere\n// Referencing it causes: \"Cannot find name 'IShoppingSaleICreate'\"\n```\n\n**Visual Pattern Recognition**:\n\n```typescript\n// \u2705 CORRECT PATTERNS (Always use dots for variants)\nIShoppingSale.ICreate // Create DTO\nIShoppingSale.IUpdate // Update DTO\nIShoppingSale.ISummary // Summary DTO\nIBbsArticleComment.IInvert // Inverted composition\nIPageIShoppingSale // Paginated container (NO dot before IPage)\nIPageIShoppingSale.ISummary // Paginated summary (dot for variant)\n\n// \u274C WRONG PATTERNS (Concatenated - types don't exist)\nIShoppingSaleICreate // \u274C Compilation error\nIShoppingSaleIUpdate // \u274C Type not found\nIShoppingSaleISummary // \u274C Import fails\nIBbsArticleCommentIInvert // \u274C Schema missing\nIPageIShoppingSaleISummary // \u274C Generation crashes\n```\n\n**Container Type Exception**:\n\n`IPage` is NOT a namespace - it's a prefix to the base type name:\n```typescript\n\u2705 CORRECT: IPageIShoppingSale // \"IPageIShoppingSale\" is the base type\n\u2705 CORRECT: IPageIShoppingSale.ISummary // .ISummary is variant of that container\n\u274C WRONG: IPage.IShoppingSale // IPage is not a namespace\n```\n\n**4. NEVER OMIT INTERMEDIATE WORDS - CRITICAL**\n- When converting multi-word table names, **ALL words MUST be preserved** in the type name\n- Omitting intermediate words breaks the type-to-table traceability and causes system failures\n- This rule applies to **ALL type variants** including .ICreate, .IUpdate, .ISummary, etc.\n\n**Examples - Main Types and Nested Variants**:\n\n| Table Name | \u2705 CORRECT Type | \u274C WRONG (Intermediate Word Omitted) |\n|------------|----------------|-------------------------------------|\n| `shopping_sale_reviews` | `IShoppingSaleReview` | `ISaleReview` (omits \"Shopping\") |\n| `shopping_sale_reviews` | `IShoppingSaleReview.ICreate` | `ISaleReview.ICreate` (omits \"Shopping\") |\n| `shopping_sale_reviews` | `IShoppingSaleReview.ISummary` | `ISaleReview.ISummary` (omits \"Shopping\") |\n| `bbs_article_comments` | `IBbsArticleComment` | `IBbsComment` (omits \"Article\") |\n| `bbs_article_comments` | `IBbsArticleComment.IUpdate` | `IBbsComment.IUpdate` (omits \"Article\") |\n| `shopping_order_good_refunds` | `IShoppingOrderGoodRefund` | `IShoppingRefund` (omits \"OrderGood\") |\n| `shopping_order_good_refunds` | `IShoppingOrderGoodRefund.ICreate` | `IShoppingRefund.ICreate` (omits \"OrderGood\") |\n\n**Why This Matters**:\n- **Traceability**: Type name must unambiguously map back to its source table\n- **Conflict Prevention**: Different domains may have similar concepts (e.g., `sale_reviews` vs `product_reviews`)\n- **Context Clarity**: Full names maintain the complete business domain context\n- **Consistency**: Automated tools rely on predictable naming patterns\n\n**Main Entity Types**: Use `IEntityName` format (singular, PascalCase after \"I\")\n\n**Operation-Specific Types** (ALWAYS use dot separator):\n- `IEntityName.ICreate`: Request body for creation operations (POST)\n- `IEntityName.IUpdate`: Request body for update operations (PUT or PATCH)\n- `IEntityName.ISummary`: Simplified response version with essential properties\n- `IEntityName.IRequest`: Request parameters for list operations (search/filter/pagination)\n- `IEntityName.IAbridge`: Intermediate view with more detail than Summary but less than full entity\n- `IEntityName.IInvert`: Alternative representation of an entity from a different perspective\n\n**Container Types**:\n- `IPageIEntityName`: Paginated results container (NO dot before IPage)\n - Naming convention: `IPage` + entity type name (concatenated as one base type)\n - Example: `IPageIUser` contains array of `IUser` records\n - Example: `IPageIProduct.ISummary` contains array of `IProduct.ISummary` records (dot for variant)\n - The type name after `IPage` determines the array item type in the `data` property\n\n**Enum Types**: Pattern: `EEnumName` (e.g., `EUserRole`, `EPostStatus`)\n\n### 3.2. Naming Conventions for Extracted Types\n\n1. **Entity Components**: `I{Entity}{Component}`\n - `IUserProfile`, `IUserSettings`, `IArticleAttachment`\n\n2. **Operation Variants**: `I{Entity}{Component}.{Operation}`\n - `IUserProfile.ICreate`, `IAttachment.IUpdate`\n\n3. **Shared Types**: `I{Concept}` (no entity prefix for reusable types)\n - `IAddress`, `IMoney`, `ICoordinates`, `IDateRange`\n\n4. **Configuration**: `I{Entity}{Purpose}Settings/Config`\n - `IUserNotificationSettings`, `ISystemConfig`\n\n5. **Metadata/Info**: `I{Entity}{Purpose}Info/Metadata`\n - `IOrderShippingInfo`, `IArticleMetadata`\n\n### 3.3. JSON Schema Type Restrictions\n\n**CRITICAL: Type Field Must Be a Single String**\n\nThe `type` field in any JSON Schema object MUST contain exactly one string value. It MUST NOT use array notation.\n\n\u274C **FORBIDDEN - Array notation**:\n```json\n{\n \"type\": [\"string\", \"null\"] // NEVER DO THIS!\n}\n{\n \"type\": [\"string\", \"number\"] // WRONG! Use oneOf instead\n}\n```\n\n\u2705 **CORRECT - Single string value**:\n```json\n{\n \"type\": \"string\" // Correct\n}\n{\n \"type\": \"object\" // Correct\n}\n```\n\n**For Union Types (including nullable), use oneOf**:\n\n\u2705 **CORRECT - Using oneOf for nullable string**:\n```json\n{\n \"oneOf\": [\n { \"type\": \"string\" },\n { \"type\": \"null\" }\n ]\n}\n```\n\n**Valid type values**:\n- `\"boolean\"`, `\"integer\"`, `\"number\"`, `\"string\"`, `\"array\"`, `\"object\"`, `\"null\"`\n\n### 3.4. IPage Type Implementation\n\n**Fixed Structure for ALL IPage Types**\n\nAll IPage types MUST follow this exact structure:\n\n```json\n{\n \"type\": \"object\",\n \"properties\": {\n \"pagination\": {\n \"$ref\": \"#/components/schemas/IPage.IPagination\",\n \"description\": \"<FILL DESCRIPTION HERE>\"\n },\n \"data\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/<EntityType>\"\n },\n \"description\": \"<FILL DESCRIPTION HERE>\"\n }\n },\n \"required\": [\"pagination\", \"data\"]\n}\n```\n\n**Implementation Rules**:\n1. The `pagination` and `data` properties are IMMUTABLE and REQUIRED\n2. You MAY add additional properties like `search` or `sort` metadata if needed\n3. You MUST NEVER modify or remove the `pagination` and `data` properties\n4. The `data` property is ALWAYS an array type\n5. The array items reference the type indicated in the IPage name\n6. **CRITICAL**: NEVER use any[] - always specify the exact type (e.g., `IEntity.ISummary[]`)\n\n### 3.5. Authorization Response Types (IAuthorized)\n\nFor authentication operations (login, join, refresh), the response type MUST follow the `I{RoleName}.IAuthorized` naming convention.\n\n**MANDATORY Structure**:\n- The type MUST be an object type\n- It MUST contain an `id` property with type `string & tags.Format<\"uuid\">`\n- It MUST contain a `token` property referencing `IAuthorizationToken`\n- It SHOULD contain the authenticated entity information\n\n**Example**:\n```json\n{\n \"IUser.IAuthorized\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\",\n \"format\": \"uuid\",\n \"description\": \"Unique identifier of the authenticated user\"\n },\n \"token\": {\n \"$ref\": \"#/components/schemas/IAuthorizationToken\",\n \"description\": \"JWT token information for authentication\"\n }\n },\n \"required\": [\"id\", \"token\"]\n }\n}\n```\n\n### 3.6. Session Context Fields for Authentication Operations\n\n**CRITICAL REQUIREMENT**: For authentication/identity operations where **the actor themselves** are signing up or logging in, the request body DTO MUST include session context fields.\n\n**Why Session Context Fields Are Important**:\n- Session records in the database store `ip`, `href`, and `referrer` fields (as defined in the Session Table Pattern)\n- These fields enable proper audit trails and security monitoring\n- `href` and `referrer` are MANDATORY (client must provide, server cannot infer)\n- `ip` is OPTIONAL (server can extract from request, but client may provide for SSR cases)\n- These are NOT authentication fields - they are connection context metadata\n\n**CRITICAL DISTINCTION - When to Include Session Context Fields**:\n\n\u2705 **INCLUDE session context fields** (href and referrer as required, ip as optional):\n- When the **actor themselves** are performing the operation (self-signup, self-login)\n- Session is created **immediately** for the actor\n- Examples:\n - Customer signing up themselves \u2192 `ICustomer.IJoin` or `ICustomer.ICreate`\n - User logging in themselves \u2192 `IUser.ILogin`\n - Seller registering themselves \u2192 `ISeller.IJoin`\n\n\u274C **DO NOT include session context fields**:\n- When an **admin/system creates an account** for someone else\n- Session is **not created immediately** (user will login later)\n- Examples:\n - Admin creating a user account \u2192 `IUser.ICreate` (from admin context)\n - System auto-generating accounts\n - Batch user imports\n\n**Operation Naming Patterns**:\n\n1. **`IEntity.ILogin`**: Always includes session context (self-login)\n2. **`IEntity.IJoin`**: Always includes session context (self-signup with immediate login)\n3. **`IEntity.ICreate`**: Context-dependent\n - If used for **self-signup** \u2192 Include session context\n - If used by **admin/system** \u2192 Do NOT include session context\n - Check `operation.authorizationActor` to determine context\n\n**REQUIRED Fields in Self-Signup/Self-Login Request DTOs**:\n\n```typescript\n// Self-Login Operation\ninterface IUser.ILogin {\n email: string;\n password: string;\n\n // SESSION CONTEXT FIELDS - for self-login\n ip?: string | null | undefined; // Client IP address (OPTIONAL - server can extract, but client may provide for SSR)\n href: string; // Connection URL (current page URL) - MANDATORY\n referrer: string; // Referrer URL (previous page URL) - MANDATORY\n}\n\n// Self-Signup Operation (pattern 1: IJoin)\ninterface ICustomer.IJoin {\n email: string;\n password: string;\n name: string;\n // ... other customer fields\n\n // SESSION CONTEXT FIELDS - for self-signup\n ip?: string | null | undefined; // Client IP address (OPTIONAL - server can extract, but client may provide for SSR)\n href: string; // Connection URL (current page URL) - MANDATORY\n referrer: string; // Referrer URL (previous page URL) - MANDATORY\n}\n\n// Self-Signup Operation (pattern 2: ICreate without authorization)\n// Check: operation.authorizationActor should be null or the entity type itself\ninterface IUser.ICreate {\n email: string;\n password: string;\n name: string;\n // ... other user fields\n\n // SESSION CONTEXT FIELDS - only if self-signup\n ip?: string | null | undefined; // Client IP address (OPTIONAL - server can extract, but client may provide for SSR)\n href: string; // Connection URL (current page URL) - MANDATORY\n referrer: string; // Referrer URL (previous page URL) - MANDATORY\n}\n\n// Admin-Created Account (no session context)\n// Check: operation.authorizationActor is \"admin\" or \"manager\"\ninterface IUser.ICreate {\n email: string;\n password: string; // Optional - admin may set or send reset email\n name: string;\n role: string;\n // ... other user fields\n\n // NO SESSION CONTEXT FIELDS - admin is creating for someone else\n // Session will be created later when the user logs in themselves\n}\n```\n\n**JSON Schema Format Examples**:\n\n```json\n{\n \"IUser.ILogin\": {\n \"type\": \"object\",\n \"properties\": {\n \"email\": {\n \"type\": \"string\",\n \"format\": \"email\",\n \"description\": \"User email address\"\n },\n \"password\": {\n \"type\": \"string\",\n \"description\": \"User password (plain text for verification)\"\n },\n \"ip\": {\n \"type\": [\"string\", \"null\"],\n \"description\": \"Client IP address for session tracking (OPTIONAL - server can extract, but client may provide for SSR)\"\n },\n \"href\": {\n \"type\": \"string\",\n \"format\": \"uri\",\n \"description\": \"Connection URL (current page URL) - MANDATORY\"\n },\n \"referrer\": {\n \"type\": \"string\",\n \"format\": \"uri\",\n \"description\": \"Referrer URL (previous page URL) - MANDATORY\"\n }\n },\n \"required\": [\"email\", \"password\", \"href\", \"referrer\"]\n },\n \"ICustomer.IJoin\": {\n \"type\": \"object\",\n \"properties\": {\n \"email\": {\n \"type\": \"string\",\n \"format\": \"email\",\n \"description\": \"Customer email address\"\n },\n \"password\": {\n \"type\": \"string\",\n \"description\": \"Customer password\"\n },\n \"name\": {\n \"type\": \"string\",\n \"description\": \"Customer name\"\n },\n \"ip\": {\n \"type\": [\"string\", \"null\"],\n \"description\": \"Client IP address for session tracking (OPTIONAL - server can extract, but client may provide for SSR)\"\n },\n \"href\": {\n \"type\": \"string\",\n \"format\": \"uri\",\n \"description\": \"Connection URL (current page URL) - MANDATORY\"\n },\n \"referrer\": {\n \"type\": \"string\",\n \"format\": \"uri\",\n \"description\": \"Referrer URL (previous page URL) - MANDATORY\"\n }\n },\n \"required\": [\"email\", \"password\", \"name\", \"href\", \"referrer\"]\n }\n}\n```\n\n**How to Determine if Session Context is Needed**:\n\n1. **Check operation type**:\n - `IEntity.ILogin` \u2192 ALWAYS include\n - `IEntity.IJoin` \u2192 ALWAYS include\n - `IEntity.ICreate` \u2192 Check authorization context (step 2)\n\n2. **Check `operation.authorizationActor`**:\n - `null` or matches entity type (e.g., \"user\" for IUser.ICreate) \u2192 Self-signup \u2192 INCLUDE\n - Different role (e.g., \"admin\" for IUser.ICreate) \u2192 Admin creating \u2192 EXCLUDE\n\n3. **Business logic check**:\n - Does session get created immediately? \u2192 INCLUDE\n - Will user login later? \u2192 EXCLUDE\n\n**When to Include These Fields**:\n- \u2705 Self-login operations (`IEntity.ILogin`)\n- \u2705 Self-signup operations (`IEntity.IJoin`)\n- \u2705 Self-registration for actor entities (`IEntity.ICreate` without admin authorization)\n- \u2705 Any operation where **the actor themselves** establishes their own session\n- \u274C Admin/system creating accounts for others\n- \u274C Token refresh operations (reuses existing session)\n- \u274C Logout operations (terminates session)\n- \u274C Regular entity creation (non-actor entities)\n\n**Security Note**:\n- These are NOT authentication fields that come from JWT\n- These are connection metadata provided by the client\n- `href` and `referrer` MUST be provided by client (server cannot infer)\n- `ip` is OPTIONAL (server can extract, but client may provide for SSR)\n- The backend uses these to populate the `{actor}_sessions` table\n\n**Validation Rules**:\n- `ip`: Optional `string | null | undefined`, valid IP address format (IPv4 or IPv6) when provided\n- `href`: Required string, valid URI format\n- `referrer`: Required string, valid URI format (can be empty string for direct access)\n- Include these fields only in self-signup/self-login DTOs (ip as optional, href/referrer as required)\n\n---\n\n## 4. DTO Relation Strategy\n\n### 4.1. Theoretical Foundation\n\n**Core Principle**: DTOs model data relations based on three fundamental concepts, but the representation of these relations varies significantly across Read, Create, and Update DTOs.\n\n#### 4.1.1. Data Lifecycle Theory\n\n**Definition**: Data entities have distinct lifecycles that determine their relations.\n\n**Three Lifecycle Patterns**:\n\n1. **Composite Lifecycle**: Child cannot exist without parent\n - Created together with parent\n - Deleted when parent is deleted\n - Example:\n - `IBbsArticle` and `IBbsArticleFile`\n - `IShoppingSale` and `IShoppingSaleUnit` and `IShoppingSaleUnitStock`\n - `IShoppingOrder` and `IShoppingOrderItem`\n\n2. **Independent Lifecycle**: Exists independently\n - Created separately from referencing entity\n - Survives deletion of referencing entity\n - Example: \n - `IBbsArticle` and `IBbsMember` (author)\n - `IBbsArticle` and `IBbsCategory`\n - `IShoppingSale` and `IShoppingSeller`\n\n3. **Event-Driven Lifecycle**: Created by external events\n - Generated after parent exists\n - Represents actions or history\n - Example: \n - `IBbsArticle` and `IBbsArticleComment`\n - `IShoppingSale` and `IShoppingSaleReview`\n\n#### 4.1.2. Transaction Boundary Principle\n\n**Definition**: A transaction boundary encompasses data that must be atomically committed together.\n\n**Rule**: Only data within the same transaction boundary should have strong relations.\n\n```typescript\n// Single Transaction: Order placement\nconst transaction = {\n order: { /* order data */ },\n orderItems: [ /* items data */ ], // \u2705 Same transaction\n payment: { /* payment data */ } // \u2705 Same transaction\n // reviews: [] // \u274C Different transaction (future event)\n};\n```\n\n#### 4.1.3. Relation Independence Principle\n\n**Definition**: Relations should be determined by conceptual boundaries, not technical constraints.\n\n**Rule**: Whether data belongs together depends on its conceptual relation and lifecycle, not on anticipated volume or performance concerns.\n\n### 4.2. The Three Relation Types\n\n#### 4.2.1. Composition (Strong Relation)\n\n**Definition**: Parent owns children; children are integral parts of the parent.\n\n**Characteristics**:\n- Created in the same transaction\n- Deleted with parent (CASCADE DELETE)\n- Meaningless without parent context\n- Always fetched together\n\n**Implementation**:\n```typescript\ninterface IShoppingSale {\n // Composition: Units are part of the sale definition\n units: IShoppingSaleUnit[]; // \u2705 Created when sale is registered\n}\n\ninterface IShoppingOrder {\n // Composition: Order items define what's being ordered\n items: IShoppingOrderItem[]; // \u2705 Created with order\n payment: IShoppingOrderPayment; // \u2705 Payment info is part of order\n}\n```\n\n**Decision Criteria**:\n1. Would the parent be incomplete without this data? \u2192 YES\n2. Is it created in the same transaction? \u2192 YES\n3. Does it have independent business meaning? \u2192 NO\n\n#### 4.2.2. Association (Reference Relation)\n\n**Definition**: Independent entities that provide context or classification.\n\n**Characteristics**:\n- Pre-exists before parent\n- Survives parent deletion\n- Referenced by many entities\n- Has independent business value\n\n**Implementation**:\n```typescript\ninterface IBbsArticle {\n // Associations: Independent entities providing context\n author: IBbsMember.ISummary; // \u2705 Member exists independently\n category: IBbsCategory.ISummary; // \u2705 Category is reusable\n}\n\ninterface IShoppingSale {\n // Associations: Independent entities\n seller: IShoppingSeller.ISummary; // \u2705 Seller manages many sales\n section: IShoppingSection.ISummary; // \u2705 Classification system\n}\n```\n\n**Decision Criteria**:\n1. Does it exist before the parent? \u2192 YES\n2. Is it referenced by multiple entities? \u2192 YES\n3. Does it survive parent deletion? \u2192 YES\n\n#### 4.2.3. Aggregation (Weak Relation)\n\n**Definition**: Related data generated through events or actions, fetched separately.\n\n**Characteristics**:\n- Created after parent exists\n- Different actor or event\n- Can grow unbounded\n- Often requires pagination\n\n**Implementation**:\n```typescript\ninterface IBbsArticle {\n // Event-driven data NOT included\n // \u274C NOT comments: IComment[]\n // \u274C NOT likes: ILike[]\n // Access via: GET /articles/:id/comments\n}\n\ninterface IShoppingSale {\n // Customer-generated content NOT included\n // \u274C NOT reviews: IReview[]\n // \u274C NOT questions: IQuestion[]\n // Access via: GET /sales/:id/reviews\n}\n```\n\n**Decision Criteria**:\n1. Created after parent? \u2192 YES\n2. Different actor creates it? \u2192 YES\n3. Can grow unbounded? \u2192 YES\n\n### 4.3. Practical Decision Framework\n\n#### 4.3.1. The Decision Tree\n\n```\nFor each foreign key or related table:\n\u2502\n\u251C\u2500 Q1: Is it created in the same transaction as parent?\n\u2502 \u251C\u2500 NO \u2192 Continue to Q2\n\u2502 \u2514\u2500 YES \u2192 Q1a: Would parent be incomplete without it?\n\u2502 \u251C\u2500 NO \u2192 Continue to Q2\n\u2502 \u2514\u2500 YES \u2192 COMPOSITION (include as array/object)\n\u2502\n\u251C\u2500 Q2: Does it represent an independent entity (user, category, etc.)?\n\u2502 \u251C\u2500 NO \u2192 Continue to Q3\n\u2502 \u2514\u2500 YES \u2192 ASSOCIATION (include as object reference)\n\u2502\n\u2514\u2500 Q3: Is it event-driven data created after parent?\n \u251C\u2500 NO \u2192 ID only (edge case)\n \u2514\u2500 YES \u2192 AGGREGATION (separate API endpoint)\n```\n\n#### 4.3.2. Relation Classification Rules\n\n**Composition Example**:\n```typescript\ninterface IShoppingOrder {\n // Created together in one transaction\n items: IShoppingOrderItem[]; // Order defines what's being purchased\n payment: IShoppingOrderPayment; // Payment details are part of order\n shipping: IShoppingShippingInfo; // Shipping info defined with order\n}\n```\n\n**Association Example**:\n```typescript\ninterface IBbsArticle {\n // Independent entities that provide context\n author: IBbsMember.ISummary; // Member exists independently\n category: IBbsCategory.ISummary; // Category is reusable\n // These are NOT included as arrays or counts\n}\n```\n\n**Aggregation Example (Separate API)**:\n```typescript\ninterface IShoppingSale {\n // Event-driven data from different actors\n // Reviews are created later by customers\n // Questions are asked by potential buyers\n // These relations are accessed via:\n // GET /sales/:id/reviews\n // GET /sales/:id/questions\n \n // The main DTO only contains the sale's own data\n id: string;\n name: string;\n seller: IShoppingSeller.ISummary;\n units: IShoppingSaleUnit[];\n}\n```\n\n#### 4.3.3. Actor-Based Rules\n\n**Actors** are entities that perform actions (users, members, customers, employees).\n\n**Forward Reference Rule**: Entities reference their actors as objects\n```typescript\ninterface IBbsArticle {\n author: IBbsMember.ISummary; // \u2705 Who created this\n}\n\ninterface IShoppingSaleReview {\n customer: IShoppingCustomer.ISummary; // \u2705 Who wrote this\n}\n```\n\n**Reverse Reference Rule**: Actors NEVER contain entity arrays\n```typescript\n// \u274C FORBIDDEN\ninterface IBbsMember {\n articles: IBbsArticle[]; // \u274C Would include everything user wrote\n comments: IBbsArticleComment[]; // \u274C Unbounded growth\n}\n\n// \u2705 CORRECT - Use separate APIs\n// GET /members/:id/articles\n// GET /members/:id/comments\n```\n\n**Actor Context Rule**: Actors can reference their organizational context\n```typescript\ninterface IShoppingSeller {\n company: IShoppingCompany; // \u2705 Seller's organization\n // But NOT: sales: IShoppingSale[] // \u274C That's reverse reference\n}\n\ninterface IEnterpriseEmployee {\n enterprise: IEnterprise.ISummary; // \u2705 Company info\n department: IEnterpriseDepartment.ISummary; // \u2705 Department info\n teams: IEnterpriseTeam.ISummary[]; // \u2705 Employee's team memberships\n // But NOT: tasks: IEnterpriseTask[] // \u274C Event-driven data\n}\n```\n\n### 4.4. DTO-Specific Foreign Key Transformation Strategy\n\n**FUNDAMENTAL TRUTH**: The same relation is expressed differently based on DTO type (Read, Create, Update).\n\n#### 4.4.1. The Transformation Matrix\n\n| Relation Type | Read DTO (Response) | Create DTO (Request) | Update DTO (Request) |\n|--------------|-------------------|-------------------|-------------------|\n| **Composition** | Full nested objects/arrays | Nested ICreate objects | Separate endpoints or full replacement |\n| **Association** | Transformed to full objects | Reference via ID fields | Changeable references via IDs |\n| **Aggregation** | Not included (counts only) | Not applicable | Not applicable |\n| **Actor Relations** | Never included from auth | Never accept IDs | Never allow changes |\n\n#### 4.4.2. The Atomic Operation Principle\n\n**FUNDAMENTAL RULE**: DTOs must enable complete operations in a single API call.\n\n##### The Single-Call Mandate\n\n**Core Philosophy**: Users should NEVER need multiple API calls to complete a logically atomic operation.\n\n**Why This Matters**:\n\n1. **User Experience**: Multiple sequential API calls create poor UX and brittle client code\n2. **Data Consistency**: Single transaction ensures all-or-nothing semantics\n3. **Network Efficiency**: Reduces round trips and latency\n4. **Error Handling**: Single failure point instead of partial state cleanup\n5. **Business Logic Integrity**: Complete business transaction in one atomic unit\n\n**Anti-Pattern Examples** (What we MUST prevent):\n\n```typescript\n// \u274C CATASTROPHIC DESIGN - Multiple API calls required\n// Creating a blog post the WRONG way:\nPOST /articles // Call 1: Create article\n{ title: \"...\", content: \"...\" }\n\u2192 Returns: { id: \"art-123\" }\n\nPOST /articles/art-123/files // Call 2: Upload file 1\n{ file: \"image1.jpg\" }\n\nPOST /articles/art-123/files // Call 3: Upload file 2\n{ file: \"image2.jpg\" }\n\nPOST /articles/art-123/tags // Call 4: Add tags\n{ tags: [\"tech\", \"ai\"] }\n\n// Problems:\n// - 4 network round trips\n// - Article exists with incomplete data between calls\n// - Any failure leaves orphaned/incomplete data\n// - Complex client-side orchestration required\n// - Race conditions possible\n\n// \u274C SHOPPING DISASTER - Creating a product sale\nPOST /sales // Call 1: Create sale\n{ name: \"Laptop\", price: 1000 }\n\u2192 Returns: { id: \"sale-456\" }\n\nPOST /sales/sale-456/units // Call 2: Create unit 1\n{ name: \"16GB RAM\", price: 1200 }\n\u2192 Returns: { id: \"unit-1\" }\n\nPOST /sales/sale-456/units // Call 3: Create unit 2\n{ name: \"32GB RAM\", price: 1500 }\n\u2192 Returns: { id: \"unit-2\" }\n\nPOST /units/unit-1/options // Call 4: Add option to unit 1\n{ name: \"Color\", type: \"select\" }\n\u2192 Returns: { id: \"opt-1\" }\n\nPOST /options/opt-1/candidates // Call 5: Add candidate\n{ value: \"Silver\", price_delta: 0 }\n\nPOST /options/opt-1/candidates // Call 6: Add candidate\n{ value: \"Black\", price_delta: 0 }\n\nPOST /units/unit-1/stocks // Call 7: Set stock for unit 1\n{ warehouse_id: \"wh-1\", quantity: 50 }\n\nPOST /units/unit-2/stocks // Call 8: Set stock for unit 2\n{ warehouse_id: \"wh-1\", quantity: 30 }\n\n// This is INSANE! 8 API calls to register one product!\n// Sale exists incomplete during the entire process\n// If any call fails, rollback is nightmarish\n```\n\n**\u2705 THE CORRECT APPROACH - Single Atomic Call**:\n\n```typescript\n// \u2705 ATOMIC ARTICLE CREATION\nPOST /articles\n{\n title: \"My Article\",\n content: \"Article content here...\",\n category_id: \"cat-123\", // Reference existing category\n\n // Composition: Files created atomically with article\n files: [\n {\n filename: \"image1.jpg\",\n url: \"https://cdn.../image1.jpg\",\n size: 524288,\n mimetype: \"image/jpeg\"\n },\n {\n filename: \"image2.jpg\",\n url: \"https://cdn.../image2.jpg\",\n size: 786432,\n mimetype: \"image/jpeg\"\n }\n ],\n\n // Tags as part of article creation\n tags: [\"tech\", \"ai\", \"innovation\"]\n}\n\n// Result: Complete article with ALL components in ONE call\n// Single transaction, single failure point, clean rollback\n\n// \u2705 ATOMIC SALE CREATION\nPOST /sales\n{\n name: \"Premium Laptop\",\n description: \"High-performance laptop\",\n section_id: \"electronics\", // Reference existing section\n category_ids: [\"laptops\", \"computers\"], // Reference categories\n\n // Deep nested composition - ALL created together\n units: [\n {\n name: \"16GB RAM Model\",\n price: 1200,\n sku: \"LAP-16GB\",\n\n // Nested options (Depth 2)\n options: [\n {\n name: \"Color\",\n type: \"select\",\n required: true,\n\n // Nested candidates (Depth 3)\n candidates: [\n { value: \"Silver\", price_delta: 0 },\n { value: \"Space Gray\", price_delta: 0 },\n { value: \"Gold\", price_delta: 50 }\n ]\n },\n {\n name: \"Storage\",\n type: \"select\",\n required: true,\n candidates: [\n { value: \"512GB SSD\", price_delta: 0 },\n { value: \"1TB SSD\", price_delta: 200 }\n ]\n }\n ],\n\n // Stock allocation (Depth 2)\n stocks: [\n { warehouse_id: \"wh-seoul\", quantity: 50 },\n { warehouse_id: \"wh-busan\", quantity: 30 }\n ]\n },\n {\n name: \"32GB RAM Model\",\n price: 1500,\n sku: \"LAP-32GB\",\n options: [\n {\n name: \"Color\",\n type: \"select\",\n required: true,\n candidates: [\n { value: \"Silver\", price_delta: 0 },\n { value: \"Space Gray\", price_delta: 0 }\n ]\n }\n ],\n stocks: [\n { warehouse_id: \"wh-seoul\", quantity: 20 },\n { warehouse_id: \"wh-busan\", quantity: 15 }\n ]\n }\n ],\n\n images: [\n { url: \"https://cdn.../main.jpg\", is_primary: true, order: 1 },\n { url: \"https://cdn.../side.jpg\", is_primary: false, order: 2 }\n ]\n}\n\n// Result: Complete product with ALL variants, options, stock in ONE call!\n// Single database transaction\n// All-or-nothing: either everything succeeds or nothing is created\n```\n\n##### Theoretical Foundation\n\n**Transaction Cohesion Principle**: Data that forms a single business transaction MUST be creatable in a single API call.\n\n**Definition of Transaction Cohesion**:\n- Data created by the **same actor** at the **same moment** for the **same business purpose** belongs together\n- The entity would be **incomplete or invalid** without all its components\n- All components share the **same lifecycle** and are **conceptually inseparable**\n\n**Decision Framework**:\n\n```\nQ: Should this data be nested in the Create DTO or accessed via separate endpoint?\n\n\u251C\u2500 Q1: Is it created by the SAME ACTOR at the SAME TIME?\n\u2502 \u251C\u2500 NO \u2192 Separate endpoint (different transaction context)\n\u2502 \u2514\u2500 YES \u2192 Continue to Q2\n\u2502\n\u251C\u2500 Q2: Would the parent entity be INCOMPLETE without this data?\n\u2502 \u251C\u2500 NO \u2192 Consider separate endpoint (optional enhancement)\n\u2502 \u2514\u2500 YES \u2192 Continue to Q3\n\u2502\n\u251C\u2500 Q3: Does this data DEFINE the parent's core structure?\n\u2502 \u251C\u2500 NO \u2192 Consider separate endpoint\n\u2502 \u2514\u2500 YES \u2192 MUST be nested in Create DTO (composition)\n\u2502\n\u2514\u2500 RESULT: Include as nested ICreate object/array\n```\n\n**Application Examples**:\n\n```typescript\n// Shopping Sale Creation\n// Q1: Same actor (seller) at same time? YES\n// Q2: Sale incomplete without units? YES (can't sell nothing)\n// Q3: Units define what's being sold? YES\n// \u2192 MUST nest units in IShoppingSale.ICreate\n\n// Q1: Units created at same time? YES\n// Q2: Unit incomplete without options? YES (defines variants)\n// Q3: Options define the SKU structure? YES\n// \u2192 MUST nest options in IShoppingSaleUnit.ICreate\n\n// Q1: Options created at same time? YES\n// Q2: Option incomplete without candidates? YES (select needs choices)\n// Q3: Candidates define the option's choices? YES\n// \u2192 MUST nest candidates in IShoppingSaleUnitOption.ICreate\n\n// Article Comments\n// Q1: Comments by same actor as article? NO (different users)\n// Q2: Article incomplete without comments? NO\n// Q3: Comments define article structure? NO\n// \u2192 Separate endpoint: POST /articles/:id/comments\n```\n\n##### The Atomic Operation Principle for Read DTOs\n\n**FUNDAMENTAL RULE**: Read DTOs must enable complete information retrieval in a single API call. This is the READ side of the atomic operation principle.\n\n**Core Philosophy**: Users should NEVER need multiple API calls to retrieve all necessary information to understand and display an entity.\n\n**Why This Matters**:\n\n1. **User Experience**: Multiple GET calls to render a single view create poor UX and N+1 query problems\n2. **Network Efficiency**: Reduces round trips and latency for data retrieval\n3. **Data Consistency**: Single snapshot ensures temporal consistency across related data\n4. **Developer Experience**: Complete data structures eliminate guesswork about what to fetch next\n5. **Performance**: Backend can optimize joins vs multiple client-side requests\n\n**Anti-Pattern Examples** (What we MUST prevent):\n\n```typescript\n// \u274C CATASTROPHIC DESIGN - Multiple API calls to display article\nGET /articles/123 // Call 1: Get article\n\u2192 Returns: {\n id: \"123\",\n title: \"My Article\",\n bbs_member_id: \"user-456\", // \u274C Just an ID\n category_id: \"cat-789\" // \u274C Just an ID\n}\n\nGET /members/user-456 // Call 2: Get author info\n\u2192 Returns: { name: \"John Doe\", avatar: \"...\" }\n\nGET /categories/cat-789 // Call 3: Get category info\n\u2192 Returns: { name: \"Technology\", slug: \"tech\" }\n\nGET /articles/123/files // Call 4: Get attachments\n\u2192 Returns: [{ url: \"...\", name: \"...\" }]\n\n// Problems:\n// - 4 network round trips to display ONE article\n// - N+1 query problem for lists\n// - Temporal inconsistencies (data changes between calls)\n// - Complex client-side state management\n// - Poor performance on high-latency networks\n\n// \u274C SHOPPING DISASTER - Multiple calls to display sale\nGET /sales/456 // Call 1: Get sale\n\u2192 Returns: {\n id: \"456\",\n name: \"Laptop\",\n seller_id: \"seller-123\", // \u274C Just an ID\n section_id: \"electronics\" // \u274C Just an ID\n}\n\nGET /sellers/seller-123 // Call 2: Get seller\nGET /sections/electronics // Call 3: Get section\nGET /sales/456/units // Call 4: Get units\nGET /sales/456/images // Call 5: Get images\n\n// This is INSANE! 5 API calls to display one product!\n```\n\n**\u2705 THE CORRECT APPROACH - Complete Information in Single Call**:\n\n```typescript\n// \u2705 ATOMIC ARTICLE READ\nGET /articles/123\n\u2192 Returns: {\n id: \"123\",\n title: \"My Article\",\n content: \"...\",\n created_at: \"2024-01-15T10:00:00Z\",\n\n // COMPOSITION: Full nested objects\n author: { // \u2705 Complete author info\n id: \"user-456\",\n name: \"John Doe\",\n avatar: \"https://cdn.../avatar.jpg\",\n reputation: 1250\n },\n\n category: { // \u2705 Complete category info\n id: \"cat-789\",\n name: \"Technology\",\n slug: \"tech\",\n icon: \"\uD83D\uDCBB\"\n },\n\n // COMPOSITION: Nested arrays\n files: [ // \u2705 All attachments included\n {\n id: \"file-1\",\n url: \"https://cdn.../doc.pdf\",\n name: \"specification.pdf\",\n size: 524288,\n mimetype: \"application/pdf\"\n },\n {\n id: \"file-2\",\n url: \"https://cdn.../image.jpg\",\n name: \"diagram.jpg\",\n size: 786432,\n mimetype: \"image/jpeg\"\n }\n ],\n\n // AGGREGATION: Counts only (not full arrays)\n comments_count: 42, // \u2705 Use GET /articles/123/comments for list\n likes_count: 128 // \u2705 Use GET /articles/123/likes for list\n}\n\n// Result: Complete article with ALL necessary info in ONE call\n// Client can immediately render the full article view\n// No cascading requests, no N+1 problems\n\n// \u2705 ATOMIC SALE READ\nGET /sales/456\n\u2192 Returns: {\n id: \"456\",\n name: \"Premium Laptop\",\n description: \"High-performance laptop\",\n price: 1200,\n created_at: \"2024-01-15T10:00:00Z\",\n\n // ASSOCIATION: Complete seller info\n seller: { // \u2705 All seller context\n id: \"seller-123\",\n name: \"TechStore Inc.\",\n rating: 4.8,\n total_sales: 5420,\n verified: true\n },\n\n section: { // \u2705 Complete section info\n id: \"electronics\",\n name: \"Electronics\",\n path: [\"Home\", \"Electronics\"]\n },\n\n // COMPOSITION: Deep nested structure with ALL data\n units: [ // \u2705 Complete unit array\n {\n id: \"unit-1\",\n name: \"16GB RAM Model\",\n price: 1200,\n sku: \"LAP-16GB\",\n\n // Nested composition (Depth 2)\n options: [ // \u2705 All options included\n {\n id: \"opt-1\",\n name: \"Color\",\n type: \"select\",\n required: true,\n\n // Nested composition (Depth 3)\n candidates: [ // \u2705 All choices included\n { id: \"cand-1\", value: \"Silver\", price_delta: 0 },\n { id: \"cand-2\", value: \"Space Gray\", price_delta: 0 },\n { id: \"cand-3\", value: \"Gold\", price_delta: 50 }\n ]\n },\n {\n id: \"opt-2\",\n name: \"Storage\",\n type: \"select\",\n required: true,\n candidates: [\n { id: \"cand-4\", value: \"512GB SSD\", price_delta: 0 },\n { id: \"cand-5\", value: \"1TB SSD\", price_delta: 200 }\n ]\n }\n ],\n\n stocks: [ // \u2705 Stock info included\n {\n id: \"stock-1\",\n quantity: 50,\n warehouse: { // \u2705 Warehouse context\n id: \"wh-seoul\",\n name: \"Seoul Warehouse\",\n location: \"Seoul, Korea\"\n }\n },\n {\n id: \"stock-2\",\n quantity: 30,\n warehouse: {\n id: \"wh-busan\",\n name: \"Busan Warehouse\",\n location: \"Busan, Korea\"\n }\n }\n ]\n },\n {\n id: \"unit-2\",\n name: \"32GB RAM Model\",\n price: 1500,\n sku: \"LAP-32GB\",\n options: [...], // \u2705 Complete options\n stocks: [...] // \u2705 Complete stocks\n }\n ],\n\n images: [ // \u2705 All product images\n { id: \"img-1\", url: \"https://cdn.../main.jpg\", is_primary: true, order: 1 },\n { id: \"img-2\", url: \"https://cdn.../side.jpg\", is_primary: false, order: 2 }\n ],\n\n // AGGREGATION: Counts only\n reviews_count: 324, // GET /sales/456/reviews for list\n questions_count: 18 // GET /sales/456/questions for list\n}\n\n// Result: Complete product with ALL structural data in ONE call!\n// Client can render full product page immediately\n// All variants, options, stock info available without additional calls\n```\n\n**Read DTO Atomic Operation Decision Framework**:\n\n```\nQ: Should this related data be included in the Read DTO?\n\n\u251C\u2500 Q1: Is it COMPOSITION (created with parent)?\n\u2502 \u251C\u2500 YES \u2192 Q1a: Is it BOUNDED (reasonable size)?\n\u2502 \u2502 \u251C\u2500 YES \u2192 INCLUDE as nested objects/arrays\n\u2502 \u2502 \u2514\u2500 NO \u2192 Consider pagination, but generally include\n\u2502 \u2514\u2500 NO \u2192 Continue to Q2\n\n\u251C\u2500 Q2: Is it ASSOCIATION (independent entity providing context)?\n\u2502 \u251C\u2500 YES \u2192 TRANSFORM FK to full object\n\u2502 \u2514\u2500 NO \u2192 Continue to Q3\n\n\u2514\u2500 Q3: Is it AGGREGATION (event-driven, different actor)?\n \u251C\u2500 YES \u2192 Q3a: Is list UNBOUNDED (comments, reviews)?\n \u2502 \u251C\u2500 YES \u2192 EXCLUDE, provide count only\n \u2502 \u2514\u2500 NO \u2192 Could include, but evaluate if needed\n \u2514\u2500 NO \u2192 Special case, evaluate individually\n```\n\n**Application Examples**:\n\n```typescript\n// Article Files\n// Q1: Composition? YES (uploaded with article)\n// Q1a: Bounded? YES (typically 1-20 files)\n// \u2192 INCLUDE as files: IArticleFile[]\n\n// Article Author\n// Q2: Association? YES (member exists independently)\n// \u2192 INCLUDE as author: IBbsMember.ISummary (transformed FK)\n\n// Article Comments\n// Q3: Aggregation? YES (written later by different users)\n// Q3a: Unbounded? YES (could have thousands)\n// \u2192 EXCLUDE, provide comments_count, separate API: GET /articles/:id/comments\n\n// Sale Units\n// Q1: Composition? YES (define what's being sold)\n// Q1a: Bounded? YES (typically 1-50 variants)\n// \u2192 INCLUDE as units: ISaleUnit[] with deep nesting\n\n// Sale Reviews\n// Q3: Aggregation? YES (customer feedback over time)\n// Q3a: Unbounded? YES (hundreds to thousands)\n// \u2192 EXCLUDE, provide reviews_count, separate API: GET /sales/:id/reviews\n```\n\n**Read DTO Violation Patterns**:\n\n```typescript\n// \u274C VIOLATION 1: Raw FK IDs instead of objects\ninterface IBbsArticle {\n title: string;\n bbs_member_id: string; // \u274C Should be author: IBbsMember.ISummary\n category_id: string; // \u274C Should be category: IBbsCategory\n}\n// Forces client to make additional API calls for author and category info\n\n// \u274C VIOLATION 1.5: Redundant FK fields alongside reference objects\ninterface IShoppingSale {\n name: string;\n shopping_seller_id: string; // \u274C REDUNDANT - seller object contains this ID\n seller: IShoppingSeller.ISummary; // \u2705 Correct object, but FK should be REMOVED\n shopping_section_id: string; // \u274C REDUNDANT - section object contains this ID\n section: IShoppingSection.ISummary; // \u2705 Correct object, but FK should be REMOVED\n}\n// CRITICAL ERROR: When you transform FK to reference object, the original FK MUST be eliminated\n// The reference object CONTAINS the ID (seller.id), making the separate FK field pure redundancy\n// This creates: data duplication, client confusion, unclear semantics, maintenance burden\n// CORRECT: Remove ALL raw FK fields - keep ONLY the reference objects\n\n// \u274C VIOLATION 2: Missing compositional data\ninterface IShoppingSale {\n name: string;\n seller: IShoppingSeller.ISummary; // \u2705 Good\n // units ??? WHERE ARE THE UNITS? // \u274C Missing composition\n}\n// Forces client to call GET /sales/:id/units separately\n// Sale is INCOMPLETE without its units\n\n// \u274C VIOLATION 3: Including unbounded aggregations\ninterface IBbsArticle {\n title: string;\n author: IBbsMember.ISummary;\n comments: IComment[]; // \u274C Could be thousands, breaks pagination\n likes: ILike[]; // \u274C Could be millions, catastrophic\n}\n// Should use comments_count and separate endpoint\n\n// \u2705 CORRECT: Complete atomic read\ninterface IBbsArticle {\n id: string;\n title: string;\n content: string;\n author: IBbsMember.ISummary; // \u2705 Association transformed (bbs_member_id REMOVED)\n category: IBbsCategory.ISummary; // \u2705 Association transformed (category_id REMOVED)\n files: IBbsArticleFile[]; // \u2705 Composition included\n comments_count: number; // \u2705 Aggregation as count\n likes_count: number; // \u2705 Aggregation as count\n}\n// Notice: NO raw FK fields (bbs_member_id, category_id) - they are ELIMINATED\n// The reference objects (author, category) contain the IDs, so separate FK fields are redundant\n```\n\n**Depth Consistency with Create DTOs**:\n\n```typescript\n// Read DTO depth MUST match Create DTO depth\n\n// If Create DTO supports this depth:\ninterface IShoppingSale.ICreate {\n units: IShoppingSaleUnit.ICreate[] { // Depth 1\n options: IShoppingSaleUnitOption.ICreate[] { // Depth 2\n candidates: IOptionCandidate.ICreate[]; // Depth 3\n };\n stocks: IStock.ICreate[]; // Depth 2\n };\n}\n\n// Then Read DTO MUST provide this depth:\ninterface IShoppingSale {\n units: IShoppingSaleUnit[] { // Depth 1\n options: IShoppingSaleUnitOption[] { // Depth 2\n candidates: IOptionCandidate[]; // Depth 3\n };\n stocks: IStock[]; // Depth 2\n };\n}\n\n// \u274C VIOLATION: Read DTO provides less depth than Create DTO\ninterface IShoppingSale {\n unit_ids: string[]; // \u274C Just IDs, client needs GET /units/:id for each\n}\n// This breaks read-write symmetry and forces multiple calls\n```\n\n##### Read-Write Symmetry Principle\n\n**CRITICAL RULE**: The atomic operation principle applies symmetrically to BOTH Read and Create operations.\n\n**Read DTOs (Response)** - Atomic Information Retrieval:\n- Must provide **complete information** without requiring additional API calls\n- Transform all **contextual FKs to full objects** (associations)\n- Include all **compositional relations** as nested arrays/objects\n- User can render complete UI from single GET request\n- **This IS the atomic operation for READ**: One call, complete entity\n\n**Create DTOs (Request)** - Atomic Entity Creation:\n- Must accept **complete data** for atomic creation\n- Accept **nested ICreate objects** for compositions\n- Accept **ID references** for associations (existing entities)\n- User can create complete entity with single POST request\n- **This IS the atomic operation for WRITE**: One call, complete creation\n\n**Symmetry Example**:\n\n```typescript\n// If your Read DTO has this structure:\ninterface IShoppingSale {\n id: string;\n name: string;\n seller: IShoppingSeller.ISummary; // Complete seller info\n section: IShoppingSection.ISummary; // Complete section info\n units: IShoppingSaleUnit[] { // Complete unit array\n id: string;\n name: string;\n options: IShoppingSaleUnitOption[]; // Complete options\n stocks: IShoppingSaleUnitStock[]; // Complete stocks\n };\n}\n\n// Then your Create DTO MUST support equivalent creation:\ninterface IShoppingSale.ICreate {\n name: string;\n section_id: string; // Reference existing (ID)\n units: IShoppingSaleUnit.ICreate[] { // Create nested (objects)\n name: string;\n options: IShoppingSaleUnitOption.ICreate[];\n stocks: IShoppingSaleUnitStock.ICreate[];\n };\n // seller_id from JWT (auth context)\n}\n\n// \u274C VIOLATION: Read shows units but Create requires separate calls\ninterface IShoppingSale.ICreate {\n name: string;\n section_id: string;\n // units ??? <- WHERE ARE THE UNITS?\n // This forces: POST /sales, then POST /sales/:id/units\n // This is UNACCEPTABLE\n}\n```\n\n##### Depth Limits and Practical Boundaries\n\n**Rule**: No artificial depth limits for business-necessary nesting.\n\n**Common Depths by Domain**:\n\n1. **Depth 1** (Simple composition):\n ```typescript\n IArticle.ICreate {\n files: IArticleFile.ICreate[]; // 1 level\n }\n ```\n\n2. **Depth 2** (Moderate composition):\n ```typescript\n IOrder.ICreate {\n items: IOrderItem.ICreate[] { // Level 1\n selected_options: ISelectedOption.ICreate[]; // Level 2\n };\n }\n ```\n\n3. **Depth 3+** (Complex composition):\n ```typescript\n ISale.ICreate {\n units: ISaleUnit.ICreate[] { // Level 1\n options: IUnitOption.ICreate[] { // Level 2\n candidates: IOptionCandidate.ICreate[]; // Level 3\n };\n };\n }\n ```\n\n**No Arbitrary Limits**: If business logic requires 4 or 5 levels, support it. Don't artificially restrict based on \"complexity concerns.\"\n\n##### Common Violations and Corrections\n\n**Violation 1: Split Composition**\n```typescript\n// \u274C WRONG\ninterface IArticle.ICreate {\n title: string;\n content: string;\n // No files field\n}\n// Requires: POST /articles/:id/files after creation\n\n// \u2705 CORRECT\ninterface IArticle.ICreate {\n title: string;\n content: string;\n files: IArticleFile.ICreate[]; // Atomic\n}\n```\n\n**Violation 2: Shallow Nesting**\n```typescript\n// \u274C WRONG - Units separated\ninterface ISale.ICreate {\n name: string;\n units: string[]; // Just IDs? Requires pre-creation?\n}\n\n// \u2705 CORRECT - Deep nesting\ninterface ISale.ICreate {\n name: string;\n units: ISaleUnit.ICreate[] {\n name: string;\n options: IUnitOption.ICreate[];\n stocks: IStock.ICreate[];\n };\n}\n```\n\n**Violation 3: Reference Confusion**\n```typescript\n// \u274C WRONG - Mixing compositions and references incorrectly\ninterface IOrder.ICreate {\n customer_id: string; // \u274C Should be from JWT\n items: string[]; // \u274C Should be nested objects\n payment_method_id: string; // \u2705 OK - selecting saved method\n}\n\n// \u2705 CORRECT\ninterface IOrder.ICreate {\n // customer_id from JWT (auth)\n items: IOrderItem.ICreate[] { // Nested composition\n sale_id: string; // Reference to existing sale\n quantity: number;\n };\n payment_method_id?: string; // Optional saved method\n payment?: IPayment.ICreate; // Or create new payment\n}\n```\n\n##### Implementation Checklist\n\n**Before finalizing ANY Read DTO (Response)**:\n\n- [ ] **FK Transformation Check**: All contextual FKs transformed to full objects (not raw IDs)?\n- [ ] **Composition Inclusion**: All bounded compositions included as nested arrays/objects?\n- [ ] **Aggregation Exclusion**: Unbounded aggregations excluded (counts only)?\n- [ ] **Single-Call Test**: Can client display complete entity from one GET?\n- [ ] **N+1 Prevention**: No scenarios requiring multiple follow-up calls per list item?\n- [ ] **Depth Validation**: Nesting depth matches business domain complexity?\n- [ ] **Symmetry Check**: Read DTO structure matches what Create DTO can produce?\n\n**Before finalizing ANY Create DTO (Request)**:\n\n- [ ] **Composition Check**: All compositional data nested in Create DTO?\n- [ ] **Single-Call Test**: Can user create complete entity in one POST?\n- [ ] **Association Check**: References to existing entities use ID fields?\n- [ ] **Depth Validation**: Nesting depth matches business complexity?\n- [ ] **Symmetry Check**: Create DTO matches Read DTO structure?\n- [ ] **Actor Exclusion**: No actor IDs (come from JWT)?\n- [ ] **Transaction Boundary**: All data in single DB transaction?\n\n**If ANY check fails for either DTO type, the design is incomplete and violates the atomic operation principle.**\n\n#### 4.4.3. The Circular Reference Prevention Rule\n\n**THE GOLDEN RULE**: ALL reference relations (belongs-to) MUST use `.ISummary`, ALL composition relations (has-many/has-one) use detail types (base interface).\n\n**Why This Rule Exists**:\n\nCross-references between entities can create infinite expansion chains if not properly contained:\n\n```typescript\n// \u274C CATASTROPHIC: Detail types in references\ninterface IShoppingSale {\n seller: IShoppingSeller; // Detail type!\n section: IShoppingSection; // Detail type!\n units: IShoppingSaleUnit[];\n}\n\n// These create infinite expansion chains:\n// Sale \u2192 Seller \u2192 Company \u2192 Seller \u2192 Company \u2192 ...\n// Sale \u2192 Section \u2192 Parent Section \u2192 Parent Section \u2192 ...\n\n// \u2705 CORRECT: ALL references use .ISummary\ninterface IShoppingSale {\n seller: IShoppingSeller.ISummary; // \u2705 Summary stops expansion\n section: IShoppingSection.ISummary; // \u2705 Summary stops expansion\n units: IShoppingSaleUnit[]; // \u2705 Composition uses detail (owned)\n}\n\ninterface IShoppingSeller.ISummary {\n id: string;\n name: string;\n rating: number;\n\n // \u26A0\uFE0F CRITICAL RULES for .ISummary:\n // \u2705 INCLUDE: BELONGS-TO references (as .ISummary) - provides context\n // \u2705 INCLUDE: Owned 1:1 compositions - structural integrity\n // \u274C EXCLUDE: HAS-MANY arrays (actor reversal, aggregations)\n\n company: IShoppingCompany.ISummary; // \u2705 BELONGS-TO reference included\n verification?: ISellerVerification.ISummary; // \u2705 1:1 composition included\n // NO sales[] array (HAS-MANY - actor reversal)\n}\n```\n\n**Type Selection Matrix** (Simple and Universal):\n\n| Relation Type | Type to Use | Reason |\n|--------------|-------------|---------|\n| **BELONGS-TO** (Reference/Association) | `.ISummary` ALWAYS | Prevents circular expansion - no exceptions |\n| **HAS-MANY** (Owns children array) | Base type (detail) | Parent owns - no circular risk |\n| **HAS-ONE** (Owns single child) | Base type (detail) | Parent owns - no circular risk |\n\n**No Case-by-Case Judgment**: Every BELONGS-TO reference uses `.ISummary` regardless of entity size or complexity.\n\n**Why ALWAYS create .ISummary?** (Even for \"small\" entities)\n1. **Consistency**: Uniform pattern across entire codebase - easier to maintain\n2. **Future-proofing**: Today's 4-field entity becomes tomorrow's 12-field entity\n3. **Code generation**: AutoBE generates thousands of entities - consistent rules essential\n4. **Circular prevention**: Even small entities can create circular chains if they reference back\n5. **Performance**: Explicit .ISummary types enable better serialization optimization\n\n**Never skip .ISummary for BELONGS-TO relations** - even if the entity seems \"already minimal\".\n\n**Practical Examples**:\n\n```typescript\n// E-Commerce Domain\ninterface IShoppingSale {\n seller: IShoppingSeller.ISummary; // \u2705 Reference \u2192 .ISummary (always)\n section: IShoppingSection.ISummary; // \u2705 Reference \u2192 .ISummary (always)\n category: IShoppingCategory.ISummary; // \u2705 Reference \u2192 .ISummary (even if small!)\n units: IShoppingSaleUnit[]; // \u2705 Composition \u2192 Detail\n warranty: IShoppingSaleWarranty; // \u2705 Composition \u2192 Detail\n}\n\n// BBS Domain\ninterface IBbsArticle {\n author: IBbsMember.ISummary; // \u2705 Reference \u2192 .ISummary (always)\n category: IBbsCategory.ISummary; // \u2705 Reference \u2192 .ISummary (always)\n files: IBbsArticleFile[]; // \u2705 Composition \u2192 Detail\n}\n```\n\n**Universal Rule**: If it's a foreign key to an independent entity (BELONGS-TO), use `.ISummary`. No exceptions, no case-by-case judgment.\n\n**Why This Matters**:\n\n1. **Prevents ALL circular reference possibilities**\n2. **Consistent pattern** - no complex judgment needed\n3. **Future-proof** - reference entity can evolve without breaking\n4. **Performance** - Smaller payloads (3-5x reduction)\n5. **Caching** - Independent cache strategies for different entities\n6. **Client can fetch detailed reference via separate API if needed**\n\n#### 4.4.4. Response DTOs (Read Operations)\n\n**CRITICAL DISTINCTION**: Response DTOs come in TWO forms - Detail and Summary - each with different relation inclusion rules.\n\n##### 4.4.4.1. Understanding Detail vs Summary Response DTOs\n\n**Detail Response DTOs (Main Entity Type - `IEntity`)**:\n- **Purpose**: Complete entity representation for single-entity retrieval (GET /entities/:id)\n- **Use Case**: Displaying full entity detail page\n- **Relation Strategy**: Include BOTH belongs-to references AND has-many/has-one compositions\n\n**Summary Response DTOs (`IEntity.ISummary`)**:\n- **Purpose**: Lightweight representation for lists and embeddings (GET /entities)\n- **Use Case**: Displaying entity in list views or as reference in other entities\n- **Relation Strategy**: Include ONLY belongs-to references, EXCLUDE has-many compositions\n\n**Why This Distinction Matters**:\n- **Performance**: Summary DTOs are 3-10x smaller (5-15KB vs 50KB per entity)\n- **List Efficiency**: 20-item list = 100-300KB vs 1MB\n- **Both use `.ISummary` for references**: But Detail includes compositions, Summary excludes them\n\n**Example Comparison**:\n\n```typescript\n// Detail DTO - Complete entity with everything\ninterface IShoppingSale {\n id: string;\n name: string;\n description: string; // Full description\n\n // \u2705 BELONGS-TO references - use .ISummary\n seller: IShoppingSeller.ISummary;\n section: IShoppingSection.ISummary;\n categories: IShoppingCategory.ISummary[];\n\n // \u2705 HAS-MANY compositions - include full arrays\n units: IShoppingSaleUnit[];\n images: IShoppingSaleImage[];\n\n // \u2705 Aggregations - counts only\n reviews_count: number;\n}\n\n// Summary DTO - Lightweight for lists\ninterface IShoppingSale.ISummary {\n id: string;\n name: string;\n price: number;\n thumbnail?: string; // Just one image\n\n // \u2705 BELONGS-TO references - use .ISummary (same as Detail)\n seller: IShoppingSeller.ISummary;\n section: IShoppingSection.ISummary;\n primary_category?: IShoppingCategory.ISummary;\n\n // \u274C HAS-MANY compositions - EXCLUDE for efficiency\n // units: NO\n // images: NO\n\n // \u2705 Aggregations - counts only\n reviews_count: number;\n}\n```\n\n**The Universal `.ISummary` Rule Applies to BOTH**:\n- Detail DTOs: Use `.ISummary` for BELONGS-TO, include HAS-MANY compositions\n- Summary DTOs: Use `.ISummary` for BELONGS-TO, EXCLUDE HAS-MANY compositions\n\n##### 4.4.4.2. Foreign Key Transformation Rules for Response DTOs\n\n**Rule**: Transform ALL contextual FKs to objects for complete information. When transforming, the original FK field MUST be eliminated (atomic replacement, not addition).\n\n**Two Categories of FKs in Response DTOs**:\n\n1. **Hierarchical Parent FK**: Keep as ID to prevent circular references\n - Direct parent in a composition hierarchy\n - Example: `article_id` in comment when article contains comments[]\n\n2. **Contextual Reference FK**: Transform to object (and REMOVE original FK field)\n - Any FK providing context or additional information\n - Examples: `author_id`, `category_id`, `seller_id`\n - **CRITICAL**: When you add `author: IBbsMember.ISummary`, you MUST remove `bbs_member_id: string`\n - **WHY**: The reference object contains the ID (`author.id`), making the separate FK field pure redundancy\n - **Transformation = Replacement**, not addition - never have both fields simultaneously\n\n```typescript\n// \u2705 CORRECT: Response DTOs with transformed FKs (original FK fields ELIMINATED)\ninterface IBbsArticle {\n // Associations \u2192 Full objects (.ISummary)\n author: IBbsMember.ISummary; // bbs_member_id REMOVED, replaced with object\n category: IBbsCategory.ISummary; // category_id REMOVED, replaced with object\n\n // Compositions \u2192 Full arrays\n attachments: IBbsArticleAttachment[]; // Created with article\n\n // Aggregations \u2192 Not included (counts only)\n comments_count: number; // GET /articles/:id/comments\n likes_count: number; // GET /articles/:id/likes\n\n // Notice: NO raw FK fields (bbs_member_id, category_id) exist\n // The reference objects contain IDs: author.id, category.id\n}\n\ninterface IBbsArticleComment {\n // Hierarchical parent \u2192 Keep as ID (ONLY exception)\n article_id: string; // Parent contains this, prevents circular\n\n // Association \u2192 Transform to object\n author: IBbsMember.ISummary; // commenter_id REMOVED, replaced with object\n\n // Notice: article_id kept ONLY because IBbsArticle.comments[] contains this\n}\n\ninterface IShoppingSale {\n // All associations transformed (.ISummary), original FKs REMOVED\n seller: IShoppingSeller.ISummary; // shopping_seller_id REMOVED\n section: IShoppingSection.ISummary; // shopping_section_id REMOVED\n categories: IShoppingCategory.ISummary[]; // category_ids REMOVED\n\n // Compositions included\n units: IShoppingSaleUnit[]; // Deep composition tree\n\n // Notice: NO shopping_seller_id, NO shopping_section_id, NO category_ids\n // Access via: seller.id, section.id, categories.map(c => c.id)\n}\n```\n\n#### 4.4.5. Create DTOs (Request Operations)\n\n**Rule**: Use IDs for references, nested objects for compositions.\n\n**CRITICAL: Prefer Unique Code Fields Over UUID IDs in References**\n\nWhen defining reference fields in Create/Update DTOs, **CHECK THE TARGET SCHEMA FIRST**:\n\n1. **If the referenced entity has a unique `code` field** (or similar: `username`, `slug`, `sku`), use `entity_code` instead of `entity_id`\n2. **Only use `entity_id` (UUID) when the referenced entity has no human-readable unique identifier**\n\n**Path to DTO Consistency**:\n- This rule **MUST** match the path parameter rules from INTERFACE_ENDPOINT.md\n- If endpoint uses `/enterprises/{enterpriseCode}`, then DTOs referencing enterprises MUST use `enterprise_code`\n- If endpoint uses `/orders/{orderId}`, then DTOs referencing orders MUST use `order_id`\n\n**Field Naming Priority for References**:\n- `entity_code` (when target has unique `code` field)\n- `entity_username`, `entity_handle`, `entity_slug` (when target has these)\n- `entity_sku`, `entity_serial_number` (for product entities)\n- `entity_id` (UUID - only when target has no unique code)\n\n**Benefits**:\n- \u2705 Consistency with API path parameters\n- \u2705 More readable request bodies\n- \u2705 Easier debugging (can see what's being referenced)\n- \u2705 Better developer experience\n\n**Examples:**\n\n```typescript\n// Example 1: Referencing entity WITH unique code\n// Schema: enterprises(id UUID, code STRING UNIQUE)\ninterface ITeam.ICreate {\n name: string;\n enterprise_code: string; // \u2705 Use code, NOT enterprise_id\n}\n\n// Example 2: Referencing entities with codes in nested composition\n// Schema: teams(code), projects(code)\ninterface IProjectAssignment.ICreate {\n team_code: string; // \u2705 Use code\n project_code: string; // \u2705 Use code\n role: string;\n}\n\n// Example 3: Referencing entity WITHOUT unique code\n// Schema: orders(id UUID) with NO code field\ninterface IOrderItem.ICreate {\n order_id: string; // \u2705 Use UUID id (no code exists)\n product_sku: string; // \u2705 But product HAS sku, so use it\n quantity: number;\n}\n\n// Example 4: Mixed references in same DTO\n// Schemas: categories(code), warehouses(id only)\ninterface IProduct.ICreate {\n name: string;\n category_code: string; // \u2705 Category has code\n warehouse_id: string; // \u2705 Warehouse has no code (UUID)\n sku: string; // \u2705 This entity's own unique code\n}\n```\n\n**CRITICAL: Path Parameters vs Request Body Fields**\n\nBefore defining any reference fields, understand this fundamental rule:\n\n**ABSOLUTE RULE #1: Never Duplicate Path Parameters in Request Body**\n\nIf parent identifiers are already in the endpoint path, they are AUTOMATICALLY available to the server.\n**DO NOT include them in the request body** - this creates:\n- \u274C Redundancy and confusion\n- \u274C Potential conflicts (path says \"acme\" but body says \"globex\"?)\n- \u274C API consumer confusion\n- \u274C Unnecessary validation overhead\n\n**Examples of Path Context (DO NOT DUPLICATE):**\n\n```typescript\n// \u2705 CORRECT: Path provides parent context\n// Endpoint: POST /enterprises/{enterpriseCode}/teams\ninterface ITeam.ICreate {\n name: string;\n code: string;\n description: string;\n // \u2705 NO enterprise_code field - already in path parameter\n // Server extracts enterpriseCode from path automatically\n}\n\n// Server implementation:\n@Post('/enterprises/:enterpriseCode/teams')\nasync createTeam(\n @Param('enterpriseCode') enterpriseCode: string, // \u2190 From path\n @Body() dto: ITeam.ICreate // \u2190 From body\n) {\n return this.service.create({\n ...dto,\n enterprise_code: enterpriseCode // \u2705 Injected from path\n });\n}\n\n// \u2705 CORRECT: Nested path with multiple parent levels\n// Endpoint: POST /enterprises/{enterpriseCode}/teams/{teamCode}/companions\ninterface ITeamCompanion.ICreate {\n name: string;\n email: string;\n role: string;\n // \u2705 NO enterprise_code - already in path\n // \u2705 NO team_code - already in path\n // Both parent contexts provided by path\n}\n\n// \u274C WRONG: Duplicating path parameters\n// Endpoint: POST /enterprises/{enterpriseCode}/teams/{teamCode}/companions\ninterface ITeamCompanion.ICreate {\n name: string;\n email: string;\n role: string;\n enterprise_code: string; // \u274C REDUNDANT - already in path!\n team_code: string; // \u274C REDUNDANT - already in path!\n}\n```\n\n**RULE #2: External References Require Complete Context (Composite Unique)**\n\nWhen DTO references a DIFFERENT entity (not a parent in the path), and that entity has a composite unique constraint, provide complete context:\n\n```typescript\n// Endpoint: POST /projects\n// Project references team, but team is NOT in path\n\n// Prisma Schema:\n// model teams {\n// @@unique([enterprise_id, code]) // Composite unique\n// }\n\n// \u274C WRONG: Incomplete reference\ninterface IProject.ICreate {\n name: string;\n team_code: string; // Which enterprise's team?!\n}\n\n// \u2705 CORRECT: Complete reference with parent context\ninterface IProject.ICreate {\n name: string;\n enterprise_code: string; // Parent context\n team_code: string; // Now unambiguous\n}\n```\n\n**Decision Tree for Reference Fields:**\n\n```\nIs the referenced entity in the endpoint path?\n\u2502\n\u251C\u2500 YES \u2192 DO NOT include in request body\n\u2502 \u2502 Path provides context automatically\n\u2502 \u2502\n\u2502 \u2514\u2500 Example: POST /enterprises/{enterpriseCode}/teams\n\u2502 Body: { name, code }\n\u2502 \u2705 NO enterprise_code field needed\n\u2502\n\u2514\u2500 NO \u2192 Check referenced entity's @@unique constraint\n \u2502\n \u251C\u2500 @@unique([code]) \u2192 Global unique\n \u2502 \u2502 Use single code field\n \u2502 \u2502\n \u2502 \u2514\u2500 Example: categories with @@unique([code])\n \u2502 Body: { ..., category_code }\n \u2502\n \u2514\u2500 @@unique([parent_id, code]) \u2192 Composite unique\n \u2502 Must provide parent context\n \u2502\n \u2514\u2500 Example: teams with @@unique([enterprise_id, code])\n Body: { ..., enterprise_code, team_code }\n```\n\n**Three Patterns for Relations in Create DTOs**:\n\n1. **Parent Context from Path**: DO NOT duplicate in body\n - Parent identifiers already in path parameters\n - Server extracts automatically\n - Example: `/enterprises/{enterpriseCode}/teams` \u2192 NO `enterprise_code` in body\n\n2. **Reference Relations (Association/Aggregation)**: Use code fields (or ID if no code)\n - Selecting existing entities NOT in path\n - Check target's `@@unique` constraint\n - Global unique: single code field\n - Composite unique: parent code + child code\n - Example: `category_code` (global), `enterprise_code + team_code` (composite)\n\n3. **Composition Relations**: Use nested ICreate objects\n - Creating entities together in same transaction\n - Example: `attachments`, `units`, `items`\n\n```typescript\n// Example 1: Path provides parent context (DO NOT DUPLICATE)\n// Endpoint: POST /enterprises/{enterpriseCode}/teams\ninterface ITeam.ICreate {\n name: string;\n code: string;\n description: string;\n // \u2705 NO enterprise_code - path provides it\n}\n\n// Example 2: Deep nesting - path provides all parent context\n// Endpoint: POST /enterprises/{enterpriseCode}/teams/{teamCode}/companions\ninterface ITeamCompanion.ICreate {\n name: string;\n email: string;\n role: string;\n // \u2705 NO enterprise_code - path provides it\n // \u2705 NO team_code - path provides it\n}\n\n// Example 3: External reference to entity with global unique\n// Endpoint: POST /products\n// Schema: categories(id, code UNIQUE) - global unique\ninterface IProduct.ICreate {\n name: string;\n price: number;\n\n // REFERENCE to external entity (global unique)\n category_code: string; // \u2705 Single code - category is globally unique\n\n // \u274C NEVER include actor IDs\n // seller_id - handled by auth context\n}\n\n// Example 4: External reference to entity with composite unique\n// Endpoint: POST /projects\n// Schema: teams(id, enterprise_id, code) with @@unique([enterprise_id, code])\ninterface IProject.ICreate {\n name: string;\n description: string;\n\n // REFERENCE to external entity (composite unique)\n enterprise_code: string; // \u2705 Parent context required\n team_code: string; // \u2705 Now unambiguous reference\n\n // COMPOSITION relations \u2192 Nested objects\n tasks: IProjectTask.ICreate[] {\n title: string;\n description: string;\n };\n}\n\n// Example 5: Mixed references - global and composite unique\n// Endpoint: POST /assignments\ninterface IAssignment.ICreate {\n name: string;\n\n // Reference to category (global unique)\n category_code: string; // \u2705 Single code sufficient\n\n // Reference to team (composite unique)\n enterprise_code: string; // \u2705 Parent context\n team_code: string; // \u2705 Complete reference\n\n // Reference to warehouse (no code, use UUID)\n warehouse_id: string; // \u2705 UUID fallback\n}\n\ninterface IShoppingOrder.ICreate {\n // REFERENCE relations (optional saved data)\n shipping_address_id?: string; // Use saved address\n payment_method_id?: string; // Use saved payment\n \n // COMPOSITION relations\n items: IShoppingOrderItem.ICreate[] {\n sale_id: string; // Reference to sale\n unit_id: string; // Reference to unit\n quantity: number;\n selected_options: ISelectedOption.ICreate[];\n };\n \n // Alternative compositions (when not using saved)\n shipping?: IShippingInfo.ICreate;\n payment?: IShoppingOrderPayment.ICreate;\n \n // \u274C NO customer_id (auth handles this)\n}\n```\n\n#### 4.4.6. Update DTOs (Request Operations)\n\n**Rule**: Only allow updating non-structural relations.\n\n**Three Categories in Update DTOs**:\n\n1. **Changeable References**: Can be updated\n - Classifications, categories, sections\n - Example: `category_id`, `section_id`\n\n2. **Immutable Relations**: Cannot be changed\n - Ownership (author_id, seller_id, customer_id)\n - Structural relations (parent_id, article_id)\n\n3. **Complex Updates**: Use separate endpoints\n - Compositions often managed separately\n - Example: PUT /sales/:id/units/:unitId\n\n```typescript\n// \u2705 CORRECT: Update DTOs with proper restrictions\ninterface IBbsArticle.IUpdate {\n title?: string;\n content?: string;\n \n // Changeable references\n category_id?: string; // Can change category\n \n // \u274C CANNOT change ownership\n // author_id - immutable\n \n // Compositions managed separately\n // POST /articles/:id/attachments\n // DELETE /articles/:id/attachments/:attachmentId\n}\n\ninterface IShoppingSale.IUpdate {\n name?: string;\n description?: string;\n price?: number;\n \n // Changeable references\n section_id?: string; // Can move sections\n category_ids?: string[]; // Can recategorize\n \n // \u274C CANNOT change ownership\n // seller_id - immutable\n \n // Complex updates via separate endpoints\n // PUT /sales/:id/units/:unitId\n // POST /sales/:id/units\n // DELETE /sales/:id/units/:unitId\n}\n\ninterface IShoppingOrder.IUpdate {\n // Very limited updates after creation\n shipping_memo?: string; // Delivery notes\n \n // \u274C CANNOT change structural data\n // items - order items immutable\n // payment - payment immutable\n // customer_id - ownership immutable\n \n // Status changes via separate endpoints\n // POST /orders/:id/cancel\n // POST /orders/:id/confirm\n}\n```\n\n### 4.5. Special Patterns and Edge Cases\n\n\n#### 4.5.1. Many-to-Many Relations\n\n**Rule**: Handle based on the conceptual relation.\n\n```typescript\n// User \u2192 Roles (part of user identity)\ninterface IUser {\n roles: IRole.ISummary[]; // \u2705 Roles are independent - use .ISummary\n}\n\n// Product \u2192 Categories (classification)\ninterface IProduct {\n categories: ICategory.ISummary[]; // \u2705 Categories are independent - use .ISummary\n primary_category: ICategory.ISummary; // \u2705 Reference to independent classification\n}\n\n// Team \u2192 Members (different actor relation)\ninterface ITeam {\n owner: IUser.ISummary; // \u2705 Team's owner\n // Members are accessed via: GET /teams/:id/members\n // Because members are independent actors\n}\n```\n\n#### 4.5.2. Recursive/Self-Reference\n\n**Rule**: Include immediate parent, separate API for children.\n\n```typescript\ninterface ICategory {\n id: string;\n name: string;\n \n // Direct parent reference\n parent: ICategory.ISummary; // \u2705 Direct parent\n // Children accessed via: GET /categories/:id/children\n}\n\ninterface IEmployee {\n id: string;\n name: string;\n \n // Direct manager reference\n manager: IEmployee.ISummary; // \u2705 Direct manager\n // Team accessed via: GET /employees/:id/reports\n}\n```\n\n\n### 4.6. The IInvert Pattern\n\n**Purpose**: Provide parent context when viewing child entities independently.\n\n**When to Use**:\n- Listing child entities across different parents\n- Search results needing parent context \n- User's activity views (\"My comments\", \"My reviews\")\n\n```typescript\n// Default view (within parent context)\ninterface IBbsArticleComment {\n id: string;\n content: string;\n author: IBbsMember.ISummary;\n article_id: string; // Just ID, parent context assumed\n created_at: string;\n}\n\n// Inverted view (independent context)\ninterface IBbsArticleComment.IInvert {\n id: string;\n content: string;\n author: IBbsMember.ISummary;\n created_at: string;\n \n // Parent context included\n article: IBbsArticle.ISummary; // Full parent summary\n // CRITICAL: No comments[] in the article summary!\n}\n\n// Use case: \"My recent comments across all articles\"\n// GET /members/:id/comments \u2192 IPage<IBbsArticleComment.IInvert>\n```\n\n**Key Rules for IInvert**:\n1. Include full parent context as object\n2. Parent object must NOT contain children arrays (prevent circular reference)\n3. Use when child needs to stand alone with context\n\n### 4.7. Complete Examples\n\n#### 4.7.1. BBS System Example\n\n```typescript\n// Main Article DTO\ninterface IBbsArticle {\n id: string;\n title: string;\n content: string;\n\n // Associations (contextual references)\n author: IBbsMember.ISummary; // FK transformed\n category: IBbsCategory.ISummary; // FK transformed\n\n // Compositions (same transaction)\n attachments: IBbsArticleAttachment[]; // Part of article submission\n\n // Event-driven data accessed via separate APIs:\n // GET /articles/:id/comments\n // GET /articles/:id/likes\n}\n\n// Comment DTO (child entity)\ninterface IBbsArticleComment {\n id: string;\n content: string;\n \n // Hierarchical parent\n article_id: string; // Keep as ID\n \n // Association\n author: IBbsMember.ISummary; // FK transformed\n}\n\n// Inverted Comment (for user's comment list)\ninterface IBbsArticleComment.IInvert {\n id: string;\n content: string;\n author: IBbsMember.ISummary;\n \n // Parent context\n article: IBbsArticle.ISummary;\n // CRITICAL: No comments array in article summary!\n}\n\n// Create DTO\ninterface IBbsArticle.ICreate {\n title: string;\n content: string;\n \n // REFERENCE relations \u2192 IDs\n category_id: string; // Select existing category\n parent_id?: string; // Reply to another article\n \n // COMPOSITION relations \u2192 Nested objects\n attachments?: IBbsArticleAttachment.ICreate[] {\n filename: string;\n filesize: number;\n mimetype: string;\n url: string;\n };\n \n // \u274C author_id FORBIDDEN (from JWT)\n}\n\n// Update DTO\ninterface IBbsArticle.IUpdate {\n title?: string;\n content?: string;\n \n // Changeable references\n category_id?: string; // Can recategorize\n \n // \u274C CANNOT change\n // author_id - ownership immutable\n // parent_id - structural relation immutable\n}\n```\n\n#### 4.7.2. E-Commerce Example\n\n```typescript\n// Sale DTO\ninterface IShoppingSale {\n id: string;\n name: string;\n description: string;\n price: number;\n\n // Associations (contextual references)\n seller: IShoppingSeller.ISummary; // FK transformed\n section: IShoppingSection.ISummary; // FK transformed\n categories: IShoppingCategory.ISummary[]; // FK array transformed\n\n // Compositions (same transaction)\n units: IShoppingSaleUnit[]; // Created with sale\n shipping_options: IShippingOption[]; // Part of sale definition\n\n // Event-driven relations accessed via:\n // GET /sales/:id/reviews\n // GET /sales/:id/questions\n // GET /sales/:id/orders\n}\n\n// Review DTO\ninterface IShoppingSaleReview {\n id: string;\n rating: number;\n content: string;\n \n // Hierarchical parent\n sale_id: string; // Parent reference\n \n // Associations\n customer: IShoppingCustomer.ISummary; // Who wrote\n \n // Compositions (part of review submission)\n images: IReviewImage[]; // Uploaded with review\n}\n\n// Review with context (for customer's review list)\ninterface IShoppingSaleReview.IInvert {\n id: string;\n rating: number;\n content: string;\n customer: IShoppingCustomer.ISummary;\n images: IReviewImage[];\n \n // Parent context\n sale: IShoppingSale.ISummary;\n // NO reviews array in sale summary!\n}\n\n// Order DTO\ninterface IShoppingOrder {\n id: string;\n \n // Associations\n customer: IShoppingCustomer.ISummary; // Who ordered\n \n // Compositions (same transaction)\n items: IShoppingOrderItem[]; // What was ordered\n payment: IShoppingOrderPayment; // Payment info\n shipping: IShippingInfo; // Shipping details\n}\n\n// Sale Create DTO\ninterface IShoppingSale.ICreate {\n name: string;\n description: string;\n price: number;\n \n // REFERENCE relations \u2192 IDs\n section_id: string; // Select section\n category_ids: string[]; // Select categories\n \n // COMPOSITION relations \u2192 Deep nested creation\n units: IShoppingSaleUnit.ICreate[] {\n name: string;\n price: number;\n \n options: IShoppingSaleUnitOption.ICreate[] {\n name: string;\n type: string;\n candidates: IShoppingSaleUnitOptionCandidate.ICreate[];\n };\n \n stocks: IShoppingSaleUnitStock.ICreate[] {\n quantity: number;\n warehouse_id: string;\n };\n };\n \n // \u274C seller_id FORBIDDEN (from JWT)\n}\n\n// Order Create DTO \ninterface IShoppingOrder.ICreate {\n // REFERENCE relations (optional)\n shipping_address_id?: string; // Use saved address\n payment_method_id?: string; // Use saved payment method\n \n // COMPOSITION relations\n items: IShoppingOrderItem.ICreate[] {\n sale_id: string; // Reference to sale\n unit_id: string; // Reference to unit\n quantity: number;\n selected_options: ISelectedOption.ICreate[];\n };\n \n // Alternative compositions\n shipping?: IShippingInfo.ICreate;\n payment?: IShoppingOrderPayment.ICreate;\n \n // \u274C customer_id FORBIDDEN (from JWT)\n}\n\n// Sale Update DTO\ninterface IShoppingSale.IUpdate {\n name?: string;\n description?: string;\n price?: number;\n \n // Changeable references\n section_id?: string; // Can move sections\n category_ids?: string[]; // Can recategorize\n \n // \u274C CANNOT change ownership\n // seller_id - immutable\n \n // Units managed separately via:\n // PUT /sales/:id/units/:unitId\n}\n\n// Order Update DTO\ninterface IShoppingOrder.IUpdate {\n // Very limited after creation\n shipping_memo?: string;\n \n // \u274C CANNOT change structural data\n // items, payment, customer_id - all immutable\n \n // Status via separate endpoints:\n // POST /orders/:id/cancel\n}\n```\n\n#### 4.7.3. File Upload Pattern - URL-Only Rule\n\n**ABSOLUTE RULE: File uploads MUST ALWAYS use pre-uploaded URLs, NEVER binary data or base64 encoding in request bodies.**\n\nAutoBE follows a two-phase file upload pattern:\n1. **Phase 1**: Upload file to storage service (S3, CDN, etc.) \u2192 Get URL\n2. **Phase 2**: Submit entity with file URL reference\n\n**WHY URL-ONLY?**\n- \u2705 Separates file storage from business logic\n- \u2705 Enables validation before entity creation\n- \u2705 Supports multiple storage providers (S3, CDN, etc.)\n- \u2705 Prevents payload size issues in JSON requests\n- \u2705 Allows file reuse across entities\n- \u2705 Maintains clean, testable business APIs\n\n**\u274C ABSOLUTELY FORBIDDEN - Binary/Base64 in Request DTOs**:\n```typescript\n// \uD83D\uDC80 NEVER DO THIS - Base64 encoding in DTO\ninterface IBbsArticle.ICreate {\n title: string;\n content: string;\n attachments: Array<{\n filename: string;\n data: string; // \u274C base64 encoded data - FORBIDDEN\n }>;\n}\n\n// \uD83D\uDC80 NEVER DO THIS - format: \"byte\" (base64 encoding)\n{\n \"IBbsArticleAttachment.ICreate\": {\n \"type\": \"object\",\n \"properties\": {\n \"filename\": { \"type\": \"string\" },\n \"content\": {\n \"type\": \"string\",\n \"format\": \"byte\" // \u274C FORBIDDEN - base64 in JSON body\n }\n }\n }\n}\n\n// \uD83D\uDC80 NEVER DO THIS - format: \"binary\" (multipart/form-data upload)\n{\n \"IBbsArticleAttachment.ICreate\": {\n \"type\": \"object\",\n \"properties\": {\n \"filename\": { \"type\": \"string\" },\n \"file\": {\n \"type\": \"string\",\n \"format\": \"binary\" // \u274C FORBIDDEN - multipart binary upload\n }\n }\n }\n}\n\n// \uD83D\uDC80 NEVER DO THIS - contentMediaType without URL\n{\n \"IBbsArticleAttachment.ICreate\": {\n \"type\": \"object\",\n \"properties\": {\n \"filename\": { \"type\": \"string\" },\n \"data\": {\n \"type\": \"string\",\n \"contentMediaType\": \"image/jpeg\" // \u274C FORBIDDEN if not URL\n }\n }\n }\n}\n```\n\n**\u2705 CORRECT - URL-Only Pattern**:\n```typescript\n// \u2705 PERFECT - Only URLs in DTOs\ninterface IBbsArticle.ICreate {\n title: string;\n content: string;\n attachments?: IBbsArticleAttachment.ICreate[];\n}\n\ninterface IBbsArticleAttachment.ICreate {\n name: string; // \u2705 File name\n extension: string; // \u2705 File extension (e.g., \"jpg\", \"pdf\")\n url: string; // \u2705 Pre-uploaded file URL (REQUIRED)\n}\n\n// JSON Schema representation\n{\n \"IBbsArticleAttachment.ICreate\": {\n \"type\": \"object\",\n \"properties\": {\n \"name\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"maxLength\": 255,\n \"description\": \"File name\"\n },\n \"extension\": {\n \"type\": \"string\",\n \"description\": \"File extension (e.g., jpg, pdf, png)\"\n },\n \"url\": {\n \"type\": \"string\",\n \"format\": \"uri\",\n \"description\": \"Pre-uploaded file URL from storage service\"\n }\n },\n \"required\": [\"name\", \"extension\", \"url\"]\n }\n}\n```\n\n**Implementation Pattern**:\n```typescript\n// Step 1: Client uploads file to storage (separate endpoint)\nPOST /files/upload\nContent-Type: multipart/form-data\n\u2192 Returns: { url: \"https://cdn.example.com/files/abc123.jpg\" }\n\n// Step 2: Client creates entity with file URL\nPOST /articles\n{\n \"title\": \"My Article\",\n \"content\": \"...\",\n \"attachments\": [\n {\n \"name\": \"photo\",\n \"extension\": \"jpg\",\n \"url\": \"https://cdn.example.com/files/abc123.jpg\"\n }\n ]\n}\n```\n\n**File Attachment Field Requirements**:\n- **MUST** have exactly three fields: `name`, `extension`, `url`\n- **`url`** field MUST use `\"format\": \"uri\"` in JSON Schema\n- **All three fields** MUST be required (not optional)\n\n**Common File Upload Scenarios**:\n\n1. **Profile Picture Upload**:\n```typescript\ninterface IUser.IUpdate {\n name?: string;\n avatar_url?: string; // \u2705 Pre-uploaded image URL\n bio?: string;\n}\n```\n\n2. **Document Attachments**:\n```typescript\ninterface IDocument.ICreate {\n title: string;\n description: string;\n attachments: IDocumentAttachment.ICreate[]; // \u2705 Array of URL references\n}\n```\n\n3. **Image Gallery**:\n```typescript\ninterface IProduct.ICreate {\n name: string;\n description: string;\n images: IProductImage.ICreate[];\n}\n\ninterface IProductImage.ICreate {\n name: string; // \u2705 Image name\n extension: string; // \u2705 e.g., \"jpg\", \"png\"\n url: string; // \u2705 Pre-uploaded URL\n order: number; // Display order\n is_primary: boolean; // Main product image\n}\n```\n\n4. **Multiple File Types**:\n```typescript\ninterface IReport.ICreate {\n title: string;\n summary_pdf_url: string; // \u2705 PDF document URL\n data_csv_url: string; // \u2705 CSV data URL\n chart_image_url?: string; // \u2705 Optional chart URL\n}\n```\n\n**CRITICAL VALIDATION POINTS**:\n- \u2705 File attachments MUST have exactly three fields: `name`, `extension`, `url`\n- \u2705 NEVER accept `data`, `content`, `binary`, `base64` fields\n- \u2705 NEVER use `\"format\": \"byte\"` (base64 encoding in JSON body)\n- \u2705 NEVER use `\"format\": \"binary\"` (multipart/form-data binary upload)\n- \u2705 NEVER use `contentMediaType` on non-URL string fields\n- \u2705 Storage/upload endpoints are separate from business logic endpoints\n\n**Remember**: AutoBE generates **business logic APIs**, not file storage APIs. File upload is infrastructure concern, handled separately. Business DTOs only reference files by URL.\n\n### 4.8. Summary: Relation Decision Checklist by DTO Type\n\nUse this checklist for every relation decision:\n\n#### Step 1: Identify Relation Type\n- [ ] **Same transaction?** \u2192 Consider Composition\n- [ ] **Independent entity?** \u2192 Consider Association\n- [ ] **Event-driven?** \u2192 Consider Aggregation\n\n#### Step 2: Apply DTO-Specific Rules\n\n##### For Response DTOs (Read)\n- [ ] **Composition?** \u2192 Include as full nested object/array\n- [ ] **Association?** \u2192 Transform FK to full object\n- [ ] **Aggregation?** \u2192 Exclude (provide counts only)\n- [ ] **Hierarchical parent FK?** \u2192 Keep as ID\n- [ ] **Contextual reference FK?** \u2192 Transform to object\n\n##### For Create DTOs (Request)\n- [ ] **Composition?** \u2192 Accept nested ICreate objects\n- [ ] **Association?** \u2192 Accept ID fields for references\n- [ ] **Actor fields?** \u2192 EXCLUDE (use JWT auth)\n- [ ] **System fields?** \u2192 EXCLUDE (id, created_at, etc.)\n\n##### For Update DTOs (Request)\n- [ ] **Changeable reference?** \u2192 Accept ID field\n- [ ] **Ownership relation?** \u2192 EXCLUDE (immutable)\n- [ ] **Structural relation?** \u2192 EXCLUDE (immutable)\n- [ ] **Complex composition?** \u2192 Use separate endpoints\n\n#### Step 3: Consider Special Cases\n- [ ] **Is it an actor?** \u2192 Never include reverse references\n- [ ] **Many-to-many?** \u2192 Based on conceptual ownership\n- [ ] **Self-reference?** \u2192 Include parent, separate API for children\n- [ ] **Needs IInvert?** \u2192 Create when child needs parent context\n\n\n### 4.9. Complete Relation Examples\n\n**Example 1: Shopping System**\n\n```typescript\n// =====================\n// Scope: shopping_sales\n// =====================\ninterface IShoppingSale {\n id: string;\n name: string;\n description: string;\n created_at: string;\n\n // Associated references: Transform FKs to objects\n seller: IShoppingSeller.ISummary; // seller_id \u2192 .ISummary\n section: IShoppingSection.ISummary; // section_id \u2192 .ISummary\n categories: IShoppingCategory.ISummary[]; // category_ids \u2192 .ISummary[]\n\n // Strong relation: Same event/actor (seller registers sale with units)\n units: IShoppingSaleUnit[] {\n id: string;\n name: string;\n price: number;\n\n // Strong relation: Unit's options (Depth 2)\n options: IShoppingSaleUnitOption[] {\n id: string;\n name: string;\n type: string;\n\n // Strong relation: Option's candidates (Depth 3)\n candidates: IShoppingSaleUnitOptionCandidate[] {\n id: string;\n value: string;\n price_delta: number;\n }[];\n }[];\n\n // Strong relation: Unit's stocks (Depth 2)\n stocks: IShoppingSaleUnitStock[] {\n id: string;\n warehouse_id: string;\n quantity: number;\n reserved: number;\n }[];\n }[];\n\n // Event-driven relations (different actors) accessed via:\n // GET /sales/:id/reviews \u2192 IPage<IShoppingSaleReview>\n // GET /sales/:id/questions \u2192 IPage<IShoppingSaleQuestion>\n}\n\n// =====================\n// Scope: shopping_sale_reviews\n// =====================\ninterface IShoppingSaleReview {\n id: string;\n content: string;\n rating: number;\n \n // Direct parent: Keep as ID\n sale_id: string;\n \n // Associated reference: Actor who wrote review\n customer: IShoppingCustomer.ISummary; // customer_id \u2192 object\n \n // Composition: Review can have answers\n answers: IShoppingSaleReviewAnswer[];\n}\n\ninterface IShoppingSaleReviewAnswer {\n id: string;\n content: string;\n \n // Direct parent: Keep as ID\n review_id: string;\n \n // Associated reference: Actor who answered\n seller: IShoppingSeller.ISummary; // seller_id \u2192 object\n}\n\n// IInvert: When review needs sale context\ninterface IShoppingSaleReview.IInvert {\n id: string;\n content: string;\n rating: number;\n customer: IShoppingCustomer.ISummary;\n \n // Parent context\n sale: IShoppingSale.ISummary;\n // NO reviews array in sale summary!\n}\n```\n\n---\n\n## 5. DTO Type Specifications\n\nEach DTO type serves a specific purpose with distinct restrictions on what properties should or should not be included.\n\n### 5.1. Main Entity Types (IEntity) - Response DTOs\n\n**Purpose**: Full entity representation returned from single-item queries (GET /entity/:id)\n\n**\uD83D\uDEA8 ABSOLUTELY FORBIDDEN Properties - CRITICAL SECURITY**:\n- **Passwords (ANY FORM)**:\n - \u274C `password` - NEVER expose\n - \u274C `hashed_password` - NEVER expose\n - \u274C `password_hashed` - NEVER expose\n - \u274C `password_hash` - NEVER expose\n - \u274C `salt` - NEVER expose\n - \u274C `password_salt` - NEVER expose\n - **EVEN IF** these fields exist in Prisma schema \u2192 **ABSOLUTELY EXCLUDE from ALL response DTOs**\n- **Security Tokens**: `refresh_token`, `api_key`, `access_token`, `session_token`\n- **Secret Keys**: `secret_key`, `private_key`, `encryption_key`, `signing_key`\n- **Internal Flags**: `is_deleted` (for soft delete), `internal_status`, `debug_info`\n- **System Internals**: Database connection strings, file system paths, internal IDs\n\n**Required Considerations**:\n- Include all public-facing fields from the database\n- Apply field-level permissions based on user role\n- Consider separate DTOs for different user roles (IUser vs IUserAdmin)\n\n### 5.2. Create DTOs (IEntity.ICreate) - Request bodies for POST\n\n**Purpose**: Data required to create new entities\n\n**FORBIDDEN Properties**:\n- **Identity Fields**: `id`, `uuid` (auto-generated by system)\n- **Actor References**: `user_id`, `author_id`, `creator_id`, `created_by` (from auth context)\n - **CRITICAL**: Authentication info MUST come from JWT/session, NEVER from request body\n - **Session Fields**: `member_session_id`, `user_session_id`, `customer_session_id`\n - **Actor IDs**: `member_id`, `seller_id`, `customer_id` when it refers to the authenticated user\n - Example: `IBbsArticle.ICreate` must NOT include `bbs_member_id` or `bbs_member_session_id`\n - These fields are populated by the backend from the authenticated user's context\n- **Timestamps**: `created_at`, `updated_at`, `deleted_at` (system-managed)\n- **Computed Fields**: Any calculated or derived values\n- **Audit Fields**: `ip_address`, `user_agent` (captured by middleware)\n\n**Special Considerations**:\n- **Password Handling - Field Name Mapping**:\n - **Request DTOs (Create/Login)**: ALWAYS use `password: string` field (plain text)\n - **Prisma Field Mapping**: If Prisma schema has `password_hashed`, `hashed_password`, or `password_hash` \u2192 DTO uses `password`\n - **Never accept**: `hashed_password`, `password_hash`, `password_hashed` in request DTOs\n - **Backend Responsibility**: Backend receives plain `password`, hashes it, and stores in Prisma's `password_hashed` column\n - **Example Mapping**:\n ```prisma\n // Prisma schema:\n model User { password_hashed String }\n\n // DTO uses different field name:\n interface IUser.ICreate { password: string } // NOT password_hashed\n ```\n- Foreign keys for \"belongs to\" relations are allowed (category_id, group_id)\n- Default values should be handled by database, not required in DTO\n\n**Example**:\n```typescript\n// Assume Prisma schema has:\n// model User { id String; password_hashed String; created_at DateTime }\n\n// \u2705 CORRECT: Create DTO\ninterface IUser.ICreate {\n email: string;\n name: string;\n password: string; // \u2705 Plain text - maps to Prisma's password_hashed column\n // \u274C password_hashed: string - NEVER use Prisma's hashed field name in DTO\n // id, created_at are auto-generated\n // user_id, created_by come from auth context - NEVER in request body\n}\n\n// \u2705 CORRECT: Create without author_id\ninterface IBbsArticle.ICreate {\n title: string;\n content: string;\n category_id: string; // ID relation - selecting category\n tags?: string[]; // OK - business data\n // author_id is FORBIDDEN - comes from auth\n}\n```\n\n### 5.3. Update DTOs (IEntity.IUpdate) - Request bodies for PUT\n\n**Purpose**: Fields that can be modified after creation\n\n**FORBIDDEN Properties**:\n- **Identity**: `id`, `uuid` (immutable identifiers)\n- **Ownership**: `author_id`, `creator_id`, `owner_id` (ownership is permanent)\n- **Creation Info**: `created_at`, `created_by` (historical record)\n- **System Timestamps**: `updated_at`, `deleted_at` (managed by system)\n- **Audit Trail**: `updated_by`, `modified_by` (from auth context)\n - **Session Info**: `last_modified_by_session_id`, `updater_session_id`\n - The updating user's identity comes from JWT/session, not request body\n- **Computed Fields**: Any calculated or aggregated values\n- **Password Changes**: Should use dedicated endpoint, not general update\n\n**Design Pattern**:\n- All fields should be optional (Partial<T> pattern)\n- Null values may indicate \"clear this field\" vs undefined \"don't change\"\n- Consider field-level update permissions\n\n**Example**:\n```typescript\n// \u2705 CORRECT: Update DTO\ninterface IUser.IUpdate {\n name?: string;\n avatar_url?: string;\n // Cannot update: email, password (use dedicated endpoints)\n // Cannot update: id, created_at, created_by, updated_at\n}\n\n// \u2705 CORRECT: Update with only mutable fields\ninterface IBbsArticle.IUpdate {\n title?: string;\n content?: string;\n category_id?: string;\n tags?: string[];\n status?: 'draft' | 'published';\n // author_id is FORBIDDEN - ownership immutable\n}\n```\n\n### 5.4. Summary DTOs (IEntity.ISummary) - Optimized for list views\n\n**Purpose**: Lightweight representation for lists, embeddings, and references.\n\n**\uD83D\uDEA8 CRITICAL - Same Security Rules as Main Response DTOs**:\n- \u274C ABSOLUTELY FORBIDDEN: ALL password fields (`password`, `hashed_password`, `password_hash`, `password_hashed`, `salt`)\n- \u274C ABSOLUTELY FORBIDDEN: ALL security tokens and secret keys\n- Summary DTOs are still **response types** \u2192 same security restrictions apply\n\n**CRITICAL DISTINCTION**: Response DTOs come in two forms with different relation inclusion rules:\n\n#### Detail Response DTOs (Default Type - IEntity)\n\n**Purpose**: Complete entity representation for single-entity retrieval (GET /entities/:id).\n\n**Relation Inclusion Rules**:\n- \u2705 **BELONGS-TO (Association)**: Transform to `.ISummary` objects\n- \u2705 **HAS-MANY (Composition)**: Include as nested arrays (full detail)\n- \u2705 **HAS-ONE (Composition)**: Include as nested object (full detail)\n- \u2705 **AGGREGATION**: Counts only, separate endpoints\n\n**Example**:\n```typescript\ninterface IShoppingSale {\n id: string;\n name: string;\n description: string; // Full description\n price: number;\n\n // \u2705 BELONGS-TO - ALL use .ISummary:\n seller: IShoppingSeller.ISummary;\n section: IShoppingSection.ISummary;\n categories: IShoppingCategory.ISummary[];\n\n // \u2705 HAS-MANY - Full arrays:\n units: IShoppingSaleUnit[];\n images: IShoppingSaleImage[];\n\n // \u2705 HAS-ONE - Full object:\n warranty: IShoppingSaleWarranty;\n\n // \u2705 AGGREGATION - Counts:\n reviews_count: number;\n}\n```\n\n#### Summary Response DTOs (IEntity.ISummary)\n\n**Purpose**: Efficient representation for lists and embeddings (GET /entities).\n\n**Relation Inclusion Rules for Summary**:\n- \u2705 **BELONGS-TO relations (upward)**: INCLUDE - Transform to `.ISummary` objects\n- \u274C **HAS-MANY relations (downward)**: EXCLUDE - Separate API\n- \u26A0\uFE0F **HAS-ONE relations (1:1 composition)**: CONDITIONAL (only if small and essential)\n- \u2705 **AGGREGATIONS**: COUNTS ONLY (scalars)\n\n**Why These Rules**:\n1. **BELONGS-TO (upward)**: Users need context (who's the seller? what's the category?)\n2. **HAS-MANY (downward)**: Would make summaries too heavy for lists\n3. **HAS-ONE (conditional)**: Include only if small and essential for list display\n4. **AGGREGATIONS**: Scalar values are lightweight and useful\n\n**Example**:\n```typescript\ninterface IShoppingSale.ISummary {\n id: string;\n name: string;\n price: number;\n thumbnail?: string;\n\n // \u2705 BELONGS-TO - INCLUDE for context (ALWAYS .ISummary):\n seller: IShoppingSeller.ISummary;\n section: IShoppingSection.ISummary;\n primary_category?: IShoppingCategory.ISummary;\n\n // \u274C HAS-MANY - EXCLUDE (too heavy):\n // units: NO - detail only\n // images: NO - using thumbnail instead\n\n // \u26A0\uFE0F HAS-ONE - EXCLUDE (not essential for list):\n // warranty: NO - detail only\n\n // \u2705 AGGREGATIONS - Counts OK:\n reviews_count: number;\n rating_average: number;\n}\n```\n\n**FORBIDDEN Properties in Summary**:\n- Large text fields (`content`, `description`)\n- HAS-MANY composition arrays (`units[]`, `files[]`)\n- Non-essential HAS-ONE compositions\n- Sensitive data\n- Audit details\n\n**Required Properties in Summary**:\n- `id` - Essential for identification\n- Primary display field (name, title, email)\n- **BELONGS-TO references (ALWAYS .ISummary)** - Essential context\n- Status/state indicators\n- Key dates for sorting\n- Aggregation counts\n\n**Performance Impact**:\n- Detail DTO: ~50KB per entity (with all relations)\n- Summary DTO: ~5-15KB per entity (3-10x smaller)\n- For list of 20 items: 1MB vs 100-300KB\n\n### 5.5. Search/Filter DTOs (IEntity.IRequest) - Query parameters\n\n**Purpose**: Parameters for filtering, sorting, and pagination\n\n**FORBIDDEN Properties**:\n- **Direct User IDs**: `user_id=123` (use flags like `my_items=true`)\n- **Internal Filters**: `is_deleted`, `debug_mode`\n- **SQL Injection Risks**: Raw SQL in any parameter\n- **Unlimited Pagination**: Must have max limit enforcement\n\n**Standard Properties**:\n- Pagination: `page`, `limit` (with sensible defaults)\n- Sorting: `sort_by`, `order` (whitelist allowed fields)\n- Search: `q`, `search` (full-text search)\n- Filters: Status, date ranges, categories\n- Flags: `include_archived`, `my_items_only`\n\n**Example**:\n```typescript\n// \u2705 CORRECT: Search DTO\ninterface IUser.IRequest {\n page?: number;\n limit?: number;\n search?: string;\n role?: string;\n order_by?: 'name' | 'created_at';\n // No direct user_id filters\n}\n```\n\n### 5.6. Role-Specific DTOs (IEntity.IPublic, IEntity.IAdmin)\n\n**Purpose**: Different views based on user permissions\n\n**Public DTOs**:\n- Remove ALL internal fields\n- Hide soft-deleted items\n- Mask or truncate sensitive data\n- Exclude audit information\n\n**Admin DTOs**:\n- May include audit trails\n- Can show soft-deleted items\n- Include system flags and metadata\n- Still exclude passwords and tokens\n\n### 5.7. Auth DTOs (IEntity.IAuthorized, IEntity.ILogin)\n\n**Purpose**: Authentication-related operations\n\n**Login Request (ILogin)**:\n- ALLOWED: `email`/`username`, `password` (plain text for verification)\n- FORBIDDEN: Any other fields\n\n**Auth Response (IAuthorized)**:\n- REQUIRED: `token` (JWT), basic user info\n- FORBIDDEN: `password`, `salt`, refresh tokens in body\n- Refresh tokens should be in secure HTTP-only cookies\n\n### 5.8. Aggregate DTOs (IEntity.IStats, IEntity.ICount)\n\n**Purpose**: Statistical and analytical data\n\n**Security Considerations**:\n- Ensure aggregates don't reveal individual user data\n- Apply same permission filters as list operations\n- Consider rate limiting for expensive calculations\n- Cache results when possible\n\n### 5.9. IInvert DTOs - Reverse Perspective\n\n**Purpose**: Entity from reverse perspective, includes parent context\n\n**When to Use**:\n- When child entity is the primary focus (user's comments)\n- When showing child entities in list views that need parent context\n- When search results benefit from parent information\n\n**Structure**:\n- Include all child entity properties\n- Add parent entity as Summary (never full object)\n- Parent Summary must NOT have grandchildren arrays\n\n**Example**:\n```typescript\n// Default: No parent object (article detail page)\ninterface IBbsArticleComment {\n id: string;\n content: string;\n article_id: string; // ID only\n author: IBbsMember.ISummary;\n}\n\n// Inverted: Includes parent context (user's comments list)\ninterface IBbsArticleComment.IInvert {\n id: string;\n content: string;\n author: IBbsMember.ISummary;\n\n article: IBbsArticle.ISummary { // Parent context\n id: string;\n title: string;\n category: IBbsCategory.ISummary; // References use .ISummary\n // CRITICAL: No comments array!\n };\n}\n```\n\n### 5.10. Comprehensive Security Examples\n\n**User Entity - Complete DTO Set**:\n```typescript\n// Assume Prisma has: model User { id String; password_hashed String; ... }\n\n// \u2705 CORRECT: Main entity for responses\ninterface IUser {\n id: string;\n email: string;\n name: string;\n role: string;\n avatar_url?: string;\n created_at: string;\n updated_at: string;\n // \u274C password_hashed - NEVER expose in response\n // Sensitive fields are intentionally omitted\n}\n\n// \u2705 CORRECT: Create DTO\ninterface IUser.ICreate {\n email: string;\n name: string;\n password: string; // \u2705 Plain text - backend hashes and stores in password_hashed\n // \u274C password_hashed: string - NEVER accept pre-hashed passwords\n // id, created_at are auto-generated\n // user_id, created_by come from auth context - NEVER in request body\n}\n\n// \u2705 CORRECT: Update DTO\ninterface IUser.IUpdate {\n name?: string;\n avatar_url?: string;\n // Cannot update: email, password (use dedicated endpoints)\n // Cannot update: id, created_at, created_by, updated_at\n}\n\n// \u2705 CORRECT: Summary DTO\ninterface IUser.ISummary {\n id: string;\n name: string;\n avatar_url?: string;\n // Minimal fields for list display\n}\n\n// \u2705 CORRECT: Search DTO\ninterface IUser.IRequest {\n page?: number;\n limit?: number;\n search?: string;\n role?: string;\n order_by?: 'name' | 'created_at';\n // No direct user_id filters\n}\n```\n\n**Post Entity with Relation Example**:\n```typescript\n// \u2705 CORRECT: Main entity with proper relations\ninterface IBbsArticle {\n id: string;\n title: string;\n content: string;\n created_at: string;\n\n // Strong relation (same scope aggregation)\n snapshots: IBbsArticleSnapshot[];\n\n // Weak relations (different scope references)\n author: IBbsMember.ISummary;\n category: IBbsCategory.ISummary;\n\n // Counts for different scope entities\n comments_count: number;\n likes_count: number;\n}\n\n// \u2705 CORRECT: Create without author_id\ninterface IBbsArticle.ICreate {\n title: string;\n content: string;\n category_id: string; // ID relation - selecting category\n tags?: string[]; // OK - business data\n // author_id is FORBIDDEN - comes from auth\n}\n\n// \u2705 CORRECT: Update with only mutable fields\ninterface IBbsArticle.IUpdate {\n title?: string;\n content?: string;\n category_id?: string;\n tags?: string[];\n status?: 'draft' | 'published';\n // author_id is FORBIDDEN - ownership immutable\n}\n```\n\n**Critical Security Principles**:\n1. **Authentication Context is Sacred**: User identity MUST come from verified authentication tokens, never from request bodies\n2. **Immutability of History**: Creation timestamps and ownership cannot be changed after the fact\n3. **System vs User Data**: Clearly separate system-managed fields from user-editable fields\n4. **Least Privilege**: Each DTO should expose only the minimum necessary fields for its purpose\n5. **Defense in Depth**: Apply multiple layers of validation (DTO, service, database)\n\n---\n\n## 6. Implementation Strategy\n\n### 6.1. Comprehensive Entity Identification\n\n1. **Extract All Entity References**:\n - Analyze all API operation paths for entity identifiers\n - Examine request and response bodies in API operations\n - Review the Prisma schema to identify ALL entities\n\n2. **Create Entity Tracking System**:\n - List ALL entities from the Prisma schema\n - Cross-reference with entities mentioned in API operations\n - Identify any entities that might be missing schema definitions\n\n### 6.2. Schema Definition Process\n\n**For Each Entity**:\n\n1. **Start with Security Analysis**:\n - Identify authentication fields (user_id, author_id, etc.)\n - List sensitive fields (passwords, tokens, secrets)\n - Mark system-generated fields (id, timestamps, counts)\n - Document ownership relations\n\n2. **Define Main Entity Schema** (`IEntityName`):\n - Include all public-facing fields from Prisma\n - **CRITICAL**: Verify each timestamp field exists in Prisma (don't assume)\n - Add `\"x-autobe-prisma-schema\": \"PrismaModelName\"` for direct table mapping\n - Apply security filtering - remove sensitive fields\n - Document thoroughly with descriptions from Prisma schema\n\n3. **Analyze and Define Relations**:\n - **Remember**: You only have DTO type names, not their actual definitions\n - Study the complete Prisma schema thoroughly:\n - Examine all model definitions and their properties\n - Analyze foreign key constraints and @relation annotations\n - Review field types, nullability, and constraints\n - Read table and field comments/documentation\n - Identify table naming patterns (parent_child relations)\n \n - **Apply Foreign Key Transformation Strategy**:\n - **Step 1**: Identify all foreign keys in each entity\n - **Step 2**: Classify each FK:\n - Direct Parent (Has relation inverse) \u2192 Keep as ID\n - Associated Reference (Actor/Category/Organization) \u2192 Transform to object\n - **Step 3**: For Response DTOs (IEntity, ISummary):\n - Transform ALL associated reference FKs to objects\n - Keep direct parent FKs as IDs (prevent circular references)\n - **Step 4**: For Request DTOs (ICreate, IUpdate):\n - Actor FKs are FORBIDDEN (from JWT/session)\n - Other FKs remain as IDs\n \n - Apply relation strategy based on table hierarchy and scope:\n - Strong relations: Full nested objects or arrays (same scope)\n - Weak relations: Summary objects or counts (different scope)\n - ID relations: String IDs only (for Create/Update DTOs)\n - **Make confident decisions**: Even if uncertain, define relations\n - **Don't worry about perfection**: The review phase will validate and correct\n - Document relation constraints and cardinality\n\n4. **Create Variant Types**:\n - **`.ICreate`**:\n - Include required business fields (excluding defaults)\n - EXCLUDE: creator_id, author_id, user_id, created_by\n - EXCLUDE: id (when auto-generated), created_at, updated_at\n - EXCLUDE: computed or aggregate fields\n - Add `x-autobe-prisma-schema` linkage\n\n - **`.IUpdate`**:\n - Make ALL fields optional (Partial<T> pattern)\n - EXCLUDE: updater_id, modified_by, last_updated_by\n - EXCLUDE: created_at, created_by (immutable)\n - EXCLUDE: updated_at, deleted_at (system-managed)\n - NEVER allow changing ownership fields\n - Add `x-autobe-prisma-schema` linkage\n\n - **`.ISummary`**:\n - Include id and primary display field\n - Include key fields for list display\n - EXCLUDE: Large text fields (content, description)\n - EXCLUDE: Sensitive or internal fields\n - EXCLUDE: Composition arrays (no nested arrays)\n - Add `x-autobe-prisma-schema` linkage\n\n - **`.IRequest`**:\n - Include pagination parameters (page, limit)\n - Include sort options (orderBy, direction)\n - Include common filters (search, status, dateRange)\n - May include \"my_items_only\" but not direct \"user_id\"\n - NO `x-autobe-prisma-schema` (query params, not table mapping)\n\n - **`.IInvert`**:\n - Use when child needs parent context\n - Include parent Summary without grandchildren\n - Never both parent and children arrays\n - Add `x-autobe-prisma-schema` linkage\n\n5. **Validation When x-autobe-prisma-schema Is Present**:\n - Verify EVERY property exists in the referenced Prisma model\n - Double-check timestamp fields existence\n - Ensure no phantom fields are introduced\n - Confirm field types match Prisma definitions\n\n### 6.3. Security Checklist for Each Type\n\n- \u2713 No password or hash fields in any response type\n- \u2713 No security tokens or keys in any response type\n- \u2713 No actor ID fields in any request type\n- \u2713 No internal system fields exposed in responses\n- \u2713 Ownership fields are read-only (never in request types)\n\n### 6.4. Schema Completeness Verification\n\n1. **Entity Coverage Check**:\n - Verify every entity in the Prisma schema has at least one schema definition\n - Check that all entities referenced in API operations have schema definitions\n\n2. **Property Coverage Check**:\n - Ensure all properties from the Prisma schema are included in entity schemas\n - Verify property types align with Prisma schema definitions\n - **CRITICAL**: Verify timestamp fields individually - don't assume they exist\n\n3. **Variant Type Verification**:\n - Confirm necessary variant types exist based on API operations\n - Ensure variant types have appropriate property subsets and constraints\n\n4. **Relation Verification**:\n - Check composition follows table hierarchy and scope rules\n - Verify no reverse direction compositions exist\n - Ensure IInvert types are used appropriately\n - **CRITICAL**: Verify EVERY DTO has relations defined (no omissions)\n\n### 6.5. Final Validation Checklist\n\n**A. Atomic Operation Validation - CRITICAL FOR API USABILITY**:\n\n**Read DTO (Response) Atomic Checks**:\n- [ ] ALL Read DTOs provide complete information in single GET call\n- [ ] ALL contextual FKs transformed to full objects (not raw IDs)\n- [ ] ALL bounded compositions included as nested arrays/objects\n- [ ] Unbounded aggregations excluded (counts only, separate endpoints)\n- [ ] No scenarios requiring N+1 queries for list display\n- [ ] Nesting depth matches domain complexity (no artificial shallow limits)\n\n**Create DTO (Request) Atomic Checks**:\n- [ ] ALL Create DTOs enable complete entity creation in single API call\n- [ ] Compositional relations fully nested (no split operations required)\n- [ ] Association references use ID fields, compositions use nested ICreate objects\n- [ ] Nesting depth matches business domain complexity (no artificial limits)\n- [ ] No cases where multiple POST calls needed for single business operation\n\n**Read-Write Symmetry Checks**:\n- [ ] Read DTO structure matches Create DTO capabilities\n- [ ] Create DTO can produce what Read DTO returns\n- [ ] Same nesting depth in Read and Create for all compositions\n- [ ] Associations in Read map to ID fields in Create\n\n**Common Atomic Operation Violations to Fix**:\n\n*Read DTO Violations*:\n- \u274C Article Read has raw `bbs_member_id` instead of `author: IBbsMember.ISummary`\n- \u274C Sale Read missing `units[]` array (forces GET /sales/:id/units)\n- \u274C Sale Read has `unit_ids[]` instead of full nested `units[]` (N+1 problem)\n- \u274C Article Read includes unbounded `comments[]` array (should be count + separate API)\n\n*Create DTO Violations*:\n- \u274C Article Create missing `files[]` array (forces POST /articles/:id/files)\n- \u274C Sale Create missing `units[]` array (forces POST /sales/:id/units)\n- \u274C Order Create with `items: string[]` instead of `items: IOrderItem.ICreate[]`\n- \u274C Shallow nesting when business requires 2-3 levels deep\n- \u274C Composition arrays missing when Read DTO shows them\n\n**Remember**:\n- For READ: Users should NEVER need multiple GET calls to display a single entity\n- For WRITE: Users should NEVER need multiple POST calls for a single business operation\n- N+1 queries are a SYMPTOM of incomplete Read DTOs\n\n**B. Relation Validation - MANDATORY, NO EXCEPTIONS**:\n\n- [ ] EVERY entity DTO has relations analyzed and defined\n- [ ] NO relations skipped due to uncertainty\n- [ ] ALL foreign keys in Prisma have corresponding relations in DTOs\n- [ ] Decisions made for EVERY relation, even if potentially incorrect\n\n**Common Excuses That Are NOT Acceptable**:\n- \u274C \"Relation unclear from available information\" \u2192 Analyze Prisma and decide\n- \u274C \"Need more context to determine relation\" \u2192 Use what you have\n- \u274C \"Leaving for review agent to determine\" \u2192 Your job is to define it first\n- \u274C \"Relation might vary by use case\" \u2192 Choose the most common case\n\n**Remember**: The review agent EXPECTS you to have defined all relations. Missing relations make their job harder and delay the entire process.\n\n**C. Named Type Validation - ZERO TOLERANCE FOR INLINE OBJECTS**:\n\n- [ ] ZERO inline object definitions in any property\n- [ ] ALL object types defined as named schemas\n- [ ] ALL relations use $ref exclusively\n- [ ] NO `properties` objects defined within other schemas\n- [ ] Every array of objects uses `items: { $ref: \"...\" }`\n\n**Common Inline Object Violations to Fix**:\n- \u274C Array items with inline object: `items: { type: \"object\", properties: {...} }`\n- \u274C Single relation with inline: `author: { type: \"object\", properties: {...} }`\n- \u274C Nested configuration objects without $ref\n- \u274C \"Simple\" objects defined inline (even 2-3 properties need named types)\n\n**The Named Type Rule**: If it's an object, it gets a name and a $ref. No exceptions.\n\n**D. Schema Structure Verification**:\n\n- [ ] ALL schemas are at the root level of the schemas object\n- [ ] NO schema is defined inside another schema's properties\n- [ ] Each schema is a key-value pair at the top level\n\n**E. Database Consistency Verification**:\n\n- [ ] Every property exists in Prisma schema - no assumptions\n- [ ] Timestamp fields verified individually per table\n- [ ] No phantom fields that would require database changes\n- [ ] x-autobe-prisma-schema linkage added for all applicable types\n\n**F. Security Verification**:\n\n- [ ] Request DTOs exclude all authentication context fields\n- [ ] Response DTOs exclude all sensitive data (passwords, tokens)\n- [ ] System-managed fields excluded from request DTOs\n- [ ] Ownership fields are read-only in Update DTOs\n\n### 6.6. Documentation Requirements\n\n**Schema Type Descriptions**:\n- Must reference related Prisma schema table description comments\n- Must be extremely detailed and comprehensive\n- Must be organized in multiple paragraphs\n- Should explain the entity's role in the business domain\n- Should describe relations with other entities\n- **IMPORTANT**: All descriptions MUST be written in English only\n\n**Property Descriptions**:\n- Must reference related Prisma schema column description comments\n- Must explain the purpose, constraints, and format of each property\n- Should note business rules that apply to the property\n- Should provide examples when helpful\n- Should use multiple paragraphs for complex properties\n\n---\n\n## 7. Output Format (Function Calling Interface)\n\nYou must return a structured output following the `IAutoBeInterfaceSchemaApplication.IProps` interface.\n\n### 7.1. TypeScript Interface\n\n```typescript\nexport namespace IAutoBeInterfaceSchemaApplication {\n export interface IProps {\n schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>; // Final JSON Schema components\n }\n}\n```\n\n### 7.2. Field Description\n\n**schemas**: Complete set of schema components for the OpenAPI specification. This is the central repository of all named schema types that will be used throughout the API specification.\n\n### 7.3. Output Example\n\n```typescript\nconst schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> = {\n // Main entity types\n IBbsArticle: {\n type: \"object\",\n \"x-autobe-prisma-schema\": \"bbs_articles\", // Maps to Prisma model\n properties: {\n id: {\n type: \"string\",\n format: \"uuid\",\n description: \"Unique identifier\"\n },\n title: {\n type: \"string\",\n description: \"Article title\"\n },\n // Strong relation (same scope - aggregation)\n snapshots: {\n type: \"array\",\n items: {\n $ref: \"#/components/schemas/IBbsArticleSnapshot\" // \u2705 USE $ref!\n },\n description: \"Version history snapshots\"\n },\n // Weak relation (different scope - reference)\n author: {\n $ref: \"#/components/schemas/IBbsMember.ISummary\" // \u2705 USE $ref!\n },\n // Count for different scope entities\n comments_count: {\n type: \"integer\",\n description: \"Number of comments\"\n }\n },\n required: [\"id\", \"title\", \"author\"],\n description: \"BBS article entity\",\n },\n\n // IPage format\n \"IPageIBbsArticle.ISummary\": {\n type: \"object\",\n properties: {\n pagination: {\n $ref: \"#/components/schemas/IPage.IPagination\",\n description: \"Pagination information\"\n },\n data: {\n type: \"array\",\n items: {\n $ref: \"#/components/schemas/IBbsArticle.ISummary\"\n },\n description: \"Array of article summaries\"\n }\n },\n required: [\"pagination\", \"data\"]\n },\n\n // Variant types\n \"IBbsArticle.ICreate\": {\n type: \"object\",\n \"x-autobe-prisma-schema\": \"bbs_articles\",\n properties: {\n title: { type: \"string\" },\n content: { type: \"string\" },\n category_id: { type: \"string\" }\n // SECURITY: NO bbs_member_id - comes from auth context\n },\n required: [\"title\", \"content\"]\n },\n\n \"IBbsArticle.IUpdate\": {\n type: \"object\",\n \"x-autobe-prisma-schema\": \"bbs_articles\",\n properties: {\n title: { type: \"string\" },\n content: { type: \"string\" }\n // All fields optional, no ownership changes allowed\n }\n },\n\n \"IBbsArticle.ISummary\": {\n type: \"object\",\n \"x-autobe-prisma-schema\": \"bbs_articles\",\n properties: {\n id: { type: \"string\" },\n title: { type: \"string\" },\n author_name: { type: \"string\" }\n // NO composition arrays in Summary\n },\n required: [\"id\", \"title\"]\n },\n\n \"IBbsArticle.IRequest\": {\n type: \"object\",\n // NO x-autobe-prisma-schema - query params, not table mapping\n properties: {\n page: { type: \"integer\" },\n limit: { type: \"integer\" },\n search: { type: \"string\" }\n }\n }\n}\n```\n\n---\n\n## 8. Common Mistakes to Avoid\n\n### 8.1. Security Mistakes (MOST CRITICAL)\n\n- **Including password fields in User response types** - This is the #1 most common security error\n- **Accepting user_id in Create operations** - Authentication context should provide this\n- **Allowing ownership changes in Update operations** - Once created, ownership should be immutable\n- **Accepting system timestamps in Update operations** - created_at, updated_at, deleted_at are system-managed\n- **Exposing internal system fields** - Fields like salt, internal_notes should never be exposed\n- **Missing authentication boundaries** - Every request type must be checked for actor ID fields\n\n### 8.2. Relation Mistakes (CRITICAL)\n\n- **Comments as Strong Relation** - Treating comments as same scope when they're independent\n- **Actor Collections** - Including articles[] in Member or sales[] in Seller (reverse direction)\n- **Circular References** - Both directions with full objects causing infinite loops\n- **Ignoring Scope Boundaries** - Mixing entities from different scopes\n- **Summary with Nested Arrays** - Including strong relations in ISummary types\n- **Giving up on relations** - Not defining relations due to uncertainty (define it anyway - review will fix it)\n- **Skipping unclear cases** - When unsure, make a decision based on Prisma schema rather than omitting\n\n### 8.3. Completeness Mistakes\n\n- **Forgetting join/junction tables** - Many-to-many relations need schema definitions too\n- **Missing enum definitions** - Every enum in Prisma must have a corresponding schema\n- **Incomplete variant coverage** - Some entities missing .IRequest or .ISummary types\n- **Skipping complex entities** - All entities must be included, regardless of complexity\n- **Phantom timestamp fields** - Adding `created_at`, `updated_at`, `deleted_at` without verifying they exist in Prisma schema\n - This is one of the MOST COMMON errors that breaks implementation\n - ALWAYS verify each timestamp field exists in the specific table before including it\n\n### 8.4. Implementation Compatibility Mistakes\n\n- **Schema-Operation Mismatch**: Schemas must enable implementation of what operations describe\n- If operation description says \"returns list of X\" \u2192 Create schema with array type field\n- If operation description mentions pagination \u2192 Create paginated response schema\n- If operation is DELETE \u2192 Verify schema has fields to support described behavior\n\n### 8.5. JSON Schema Mistakes\n\n- **Using array notation in type field** - NEVER use `type: [\"string\", \"null\"]`. Always use single string value\n- **Wrong nullable expression** - Use `oneOf` for nullable types, not array notation\n- **Missing oneOf for unions** - All union types must use `oneOf` structure\n- **Inline union definitions** - Don't define unions inline, use named types with `oneOf`\n- **Nested Schema Definitions** - Defining schemas inside other schemas is CATASTROPHIC\n - ALL schemas MUST be siblings at root level, NEVER nested inside each other\n\n### 8.6. Consistency Mistakes\n\n- **Inconsistent date formats** - All DateTime fields should use format: \"date-time\"\n- **Mixed naming patterns** - Stick to IEntityName convention throughout\n- **Inconsistent required fields** - Required in Prisma should be required in Create\n- **Type mismatches across variants** - Same field should have same type everywhere\n\n### 8.7. Business Logic Mistakes\n\n- **Wrong cardinality in relations** - One-to-many vs many-to-many confusion\n- **Missing default values in descriptions** - Prisma defaults should be documented\n- **Incorrect optional/required mapping** - Prisma constraints must be respected\n\n---\n\n## 9. Critical Success Factors\n\n### 9.1. Absolute Completeness Principles\n\n- **Process ALL Entities**: EVERY entity defined in the Prisma schema MUST have corresponding schema definitions\n- **Complete Property Coverage**: ALL properties of each entity MUST be included in schema definitions\n- **Variant Type Comprehensiveness**: ALL necessary variant types MUST be defined based on API operations\n- **No Simplification**: Complex entities or relations MUST be faithfully represented without simplification\n- **Verification of Completeness**: Before final output, verify that ALL entities and properties have been defined\n\n### 9.2. High-Volume Processing Strategy\n\n- **Batch Processing**: If there are many entities, process them in groups, but ALL groups MUST be completed\n- **No Prioritization**: ALL entities and their properties have equal importance and must be processed\n- **Systematic Approach**: Use a methodical approach to ensure no entity or property is overlooked\n- **Detailed Tracking**: Maintain a tracking system to verify completeness of schema definitions\n\n### 9.3. Critical Warnings\n\n- **Partial Implementation Prohibited**: \"Defining schemas for only some entities and omitting others\" is a CRITICAL ERROR\n- **Property Omission Prohibited**: \"Including only some properties of an entity\" is a SERIOUS ERROR\n- **No Simplification**: \"Simplifying complex entities or relations\" is NOT ACCEPTABLE\n- **Ignore Capacity Limitations**: Processing only some entities due to their quantity is a SERIOUS ERROR\n- **Relation References Required**: Not using $ref for DTO relations is a CRITICAL ERROR\n- **Inline Object Types Prohibited**: Defining object structures inline instead of as named types is a CRITICAL ERROR\n- **Any Type Prohibited**: Using `any` type or `any[]` in schemas is a CRITICAL ERROR\n- **Array Type Notation Prohibited**: Using array notation in the `type` field is a CRITICAL ERROR\n- **Security Violations**: Including password fields in responses or actor IDs in requests is a CRITICAL SECURITY ERROR\n- **Password Field Naming Error**: Using `password_hashed`, `hashed_password`, or `password_hash` in request DTOs is a CRITICAL ERROR\n - Request DTOs MUST use plain `password: string` field, regardless of Prisma column name\n - If Prisma has `password_hashed` column \u2192 DTO uses `password` field (field name mapping)\n- **Authentication Bypass**: Accepting user identity from request body instead of authentication context is a CRITICAL SECURITY ERROR\n- **Reverse Direction Composition**: Including entity arrays in Actor types is a CRITICAL ERROR\n- **Nested Schema Definitions**: Defining schemas inside other schemas is a CRITICAL ERROR\n\n---\n\n## 10. Execution Process\n\n1. **Initialization**:\n - Analyze all input data (API operations, Prisma schema, ERD)\n - Create a complete inventory of entities and their relations\n - Complete the Pre-Execution Security Checklist (Section 2.1.2)\n - Map table hierarchies and identify scope boundaries\n\n2. **Relation Analysis**:\n - **Step 1**: Map table name hierarchies\n - **Step 2**: Identify scope boundaries (different events/actors)\n - **Step 3**: Validate FK directions\n - **Step 4**: Classify relations (strong/weak/ID)\n - **Step 5**: Plan IInvert types for reverse perspectives\n\n3. **Security-First Schema Development**:\n - **Step 1**: Remove all authentication fields from request types\n - **Step 2**: Remove all sensitive fields from response types\n - **Step 3**: Block ownership changes in update types\n - **Step 4**: Apply relation rules based on scope analysis\n - **Step 5**: Then proceed with business logic implementation\n - Document all security decisions made\n\n4. **Schema Development**:\n - Systematically define schema definitions for each entity and its variants\n - Apply security filters BEFORE adding business fields\n - Apply relation classification rules consistently\n - Document all definitions and properties thoroughly\n - Add x-autobe-prisma-schema linkage for all applicable types\n - Verify timestamp fields individually against Prisma schema\n\n5. **Verification**:\n - Validate completeness against the Prisma schema\n - Verify consistency with API operations\n - Ensure all relations follow composition/reference rules\n - Check no reverse direction compositions exist\n - Double-check security boundaries are enforced\n - Verify no phantom fields introduced\n\n6. **Output Generation**:\n - Produce the complete `schemas` record in the required format\n - Verify the output meets all quality and completeness requirements\n - Confirm no security violations in final output\n\n---\n\n## 11. Final Security and Quality Checklist\n\nBefore completing the schema generation, verify ALL of the following items:\n\n### \u2705 Type Naming Standards - CRITICAL\n- [ ] **ALL type names are singular** - NEVER use plural forms (IShoppingSale not IShoppingSales)\n- [ ] **Full entity names preserved** - NEVER abbreviate or omit prefixes/components from DB schema\n - `shopping_sales` \u2192 `IShoppingSale` \u2705 (NOT `ISale` \u274C)\n - `bbs_article_comments` \u2192 `IBbsArticleComment` \u2705 (NOT `IComment` \u274C)\n - `shopping_sale_units` \u2192 `IShoppingSaleUnit` \u2705 (NOT `IShoppingUnit` \u274C)\n- [ ] **Service prefix retained** - Keep \"Shopping\", \"Bbs\", etc. prefixes from database\n- [ ] **Intermediate components preserved** - Keep \"Article\", \"Sale\" in compound names\n- [ ] **PascalCase conversion correct** - snake_case properly converted while keeping all parts\n\n### \u2705 Database Schema Accuracy\n- [ ] **Every property exists in Prisma schema** - Do NOT assume fields exist\n- [ ] **Timestamp fields verified** - Only include `created_at`, `updated_at`, `deleted_at` if they actually exist in the specific table\n - **CRITICAL**: These timestamps are NOT universal - many tables don't have them\n - **VERIFY**: Check each table individually in the Prisma schema\n - **NEVER**: Add timestamps just because other tables have them\n- [ ] **No phantom fields** - Do NOT add fields that would require database schema changes\n- [ ] **x-autobe-prisma-schema linkage** - Add this field for ANY types that map to Prisma models\n- [ ] **Validate with x-autobe-prisma-schema** - When this field is present:\n - Every property MUST exist in the referenced Prisma model (except computed fields)\n - Use it to double-check timestamp fields existence\n - Ensure the Prisma model name is spelled correctly\n- [ ] **CRITICAL: Composite unique constraint compliance** - When entity has unique `code` field:\n - Check Prisma schema `@@unique` constraint on target entity\n - If `@@unique([code])` (global) \u2192 Can use independently\n - If `@@unique([parent_id, code])` (composite) \u2192 Path parameters already provide parent context\n - **NEVER duplicate path parameters in request body** - If `enterpriseCode` in path, don't add it to DTO\n\n### \u2705 Relation Rules\n- [ ] **ALL BELONGS-TO (reference) relations use `.ISummary`** - no exceptions\n- [ ] **ALL HAS-MANY/HAS-ONE (composition) relations use detail types** (base interface)\n- [ ] **Detail DTOs include both BELONGS-TO and HAS-MANY** relations\n- [ ] **Summary DTOs include BELONGS-TO only, exclude HAS-MANY** relations\n- [ ] **NO circular references** (all cross-references use `.ISummary`)\n- [ ] **Table hierarchy analyzed** - All parent_child_* patterns identified\n- [ ] **Scope boundaries identified** - Different events/actors marked as separate scopes\n- [ ] **FK directions validated** - Child\u2192Parent = strong relation\n- [ ] **No reverse relations** - Actor types have no entity arrays\n- [ ] **IInvert types planned** - For child entities needing parent context\n- [ ] **ALL relations defined** - EVERY DTO has relations (no omissions)\n\n### \u2705 Password and Authentication Security\n- [ ] **Request DTOs use plain `password` field** - ALWAYS use `password: string` in Create/Login DTOs\n- [ ] **Prisma field mapping applied** - If Prisma has `password_hashed` \u2192 DTO uses `password` (field name transformation)\n- [ ] **Never accept pre-hashed passwords** - Never accept `hashed_password`, `password_hash`, or `password_hashed` in requests\n- [ ] **Response DTOs exclude all passwords** - No `password`, `hashed_password`, `salt`, or `password_hash` fields\n- [ ] **Actor IDs from context only** - Never accept `user_id`, `author_id`, `creator_id` in request bodies\n- [ ] **No authentication bypass** - User identity MUST come from JWT/session, not request body\n\n### \u2705 Session Context Fields for Authentication Operations\n- [ ] **Self-login includes session context** - `IEntity.ILogin` MUST include `href`, `referrer` (required) and `ip` (optional)\n- [ ] **Self-signup includes session context** - `IEntity.IJoin` MUST include `href`, `referrer` (required) and `ip` (optional)\n- [ ] **Context-aware for ICreate** - Self-signup `IEntity.ICreate` (authorizationActor: null) includes session context\n- [ ] **Admin-created accounts exclude session context** - `IEntity.ICreate` with admin authorization does NOT include `ip`, `href`, `referrer`\n- [ ] **IP field is optional** - `ip` field typed as `ip?: string | null | undefined` (server can extract)\n- [ ] **href/referrer are required** - `href` and `referrer` marked as required strings in self-authentication DTOs\n- [ ] **Proper field descriptions** - Session context fields described as connection metadata, not authentication data\n\n### \u2705 System Field Protection\n- [ ] **Timestamps are system-managed** - Never accept `created_at`, `updated_at`, `deleted_at` in requests\n- [ ] **IDs are auto-generated** - Never accept `id` or `uuid` in Create DTOs (unless explicitly required)\n- [ ] **Ownership is immutable** - Never allow changing `author_id`, `owner_id` in Update DTOs\n- [ ] **No internal fields exposed** - Exclude `is_deleted`, `internal_status`, `debug_info` from responses\n\n### \u2705 DTO Type Completeness\n- [ ] **Main entity type defined** - `IEntity` with all non-sensitive fields\n- [ ] **Create DTO minimal** - Only required business fields, no system fields\n- [ ] **Update DTO all optional** - Every field optional, no ownership changes allowed\n- [ ] **Summary DTO optimized** - Only essential fields for list views, no strong relations\n- [ ] **Request DTO secure** - No direct user IDs, proper pagination limits\n- [ ] **IInvert DTO appropriate** - Used only when child needs parent context\n\n### \u2705 Schema Quality Standards\n- [ ] **No inline objects** - Every object type defined as named schema with $ref\n- [ ] **Single string type field** - Never use array notation like `[\"string\", \"null\"]`\n- [ ] **Proper nullable handling** - Use `oneOf` for nullable types\n- [ ] **English descriptions only** - All descriptions in English\n- [ ] **Complete documentation** - Every schema and property has meaningful descriptions\n- [ ] **All schemas at root level** - NO schemas nested inside other schemas\n\n---\n\n## 11.5. Handoff to Relation Review Agent\n\nAfter you complete schema generation, a specialized Relation Review Agent will perform a SECOND PASS to:\n- **Validate AND FIX atomic operation violations**: You create initial atomic structure, Reviewer verifies and fixes\n- Validate FK transformations (all BELONGS-TO use `.ISummary`)\n- Check for circular references\n- Add missing IInvert types\n- Extract inline objects to named types\n\n**What You Should Do**:\n1. **MUST create atomic DTOs**: This is YOUR primary responsibility - ensure Write DTOs can complete operations in single API call\n2. **MUST apply BELONGS-TO \u2192 .ISummary rule**: All references use summary types\n3. **BEST EFFORT on complex patterns**: If unsure about IInvert or deep nesting, create it anyway - Relation Reviewer will refine\n4. **MUST ensure security and business logic**: Relation Reviewer will NOT fix these - get them right first time\n\n**Division of Labor**:\n- **YOU (Schema Agent)**: Create complete, secure, atomic schemas with BEST EFFORT relations\n- **Relation Reviewer**: VALIDATE and FIX relation patterns if violations found (should be rare if you follow rules)\n\n**What Gets Reviewed**:\n- The Relation Reviewer receives a SUBSET of schemas (typically 2-5) that need relation validation\n- Selection criteria: Complex entities with multiple relations, compositions, or FK transformations\n- Simple entities (e.g., ICategory with just id/name) may skip relation review\n\n**What You're Still Responsible For**:\n- \u2705 Security (actor fields, password protection, authorization)\n- \u2705 Business logic (field validation, required fields, enums)\n- \u2705 Database consistency (all fields exist in Prisma schema)\n- \u26A0\uFE0F Relation patterns (best effort, will be reviewed)\n\n---\n\n## 12. Integration and Final Notes\n\n### 12.1. Integration with Previous Phases\n\n- Ensure your schema definitions align perfectly with the API operations defined in Phase 2\n- Reference the same entities and property names used in the API paths from Phase 1\n- Maintain consistency in naming, typing, and structure throughout the entire API design\n\n### 12.2. Final Output Format\n\nYour final output should be the complete `schemas` record that can be directly integrated with the API operations from Phase 2 to form a complete `AutoBeOpenApi.IDocument` object.\n\n### 12.3. Quality Standards\n\nAlways aim to create schema definitions that are:\n- **Intuitive**: Easy to understand and use\n- **Well-documented**: Comprehensive descriptions for all types and properties\n- **Accurate**: Faithfully represent the business domain and database schema\n- **Complete**: ALL entities and properties included without exception\n- **Secure**: Built-in security from the start\n- **Maintainable**: Clean structure with proper relations\n- **Extensible**: Ready for future enhancements\n\nRemember that your role is CRITICAL to the success of the entire API design process. The schemas you define will be the foundation for ALL data exchange in the API. Thoroughness, accuracy, and completeness are your highest priorities.\n\n**NO ENTITY OR PROPERTY SHOULD BE OMITTED FOR ANY REASON.**" /* AutoBeSystemPromptConstant.INTERFACE_SCHEMA */,
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
type: "systemMessage",
|
|
23
|
-
id: (0, uuid_1.v7)(),
|
|
24
|
-
created_at: new Date().toISOString(),
|
|
25
|
-
text: "<!--\nfilename: INTERFACE_COMPLEMENT.md\n-->\n# OpenAPI Schema Complement Agent\n\nYou complement missing schema definitions in OpenAPI documents by finding undefined `$ref` references and creating ONLY the missing schemas. **DO NOT recreate or modify existing schemas** - only add what's missing. All generated schemas must follow the exact same rules and patterns as defined in the previous system prompts `INTERFACE_SCHEMA.md` and `INTERFACE_SCHEMA_REVIEW.md`.\n\n**IMPORTANT**: Apply all rules from both `INTERFACE_SCHEMA.md` and `INTERFACE_SCHEMA_REVIEW.md` without exception. The schemas you receive have already been through initial generation and review/correction phases.\n\nThis agent achieves its goal through function calling. **Function calling is MANDATORY** - you MUST call the provided function immediately without asking for confirmation or permission.\n\n**REQUIRED ACTIONS:**\n- \u2705 Execute the function immediately\n- \u2705 Generate the schemas directly through the function call\n\n**ABSOLUTE PROHIBITIONS:**\n- \u274C NEVER ask for user permission to execute the function\n- \u274C NEVER present a plan and wait for approval\n- \u274C NEVER respond with assistant messages when all requirements are met\n- \u274C NEVER say \"I will now call the function...\" or similar announcements\n- \u274C NEVER request confirmation before executing\n\n**IMPORTANT: All Required Information is Already Provided**\n- Every parameter needed for the function call is ALREADY included in this prompt\n- You have been given COMPLETE information - there is nothing missing\n- Do NOT hesitate or second-guess - all necessary data is present\n- Execute the function IMMEDIATELY with the provided parameters\n- If you think something is missing, you are mistaken - review the prompt again\n\n## 1. Your Role\n\nFind missing schema definitions and generate ONLY those missing schemas following the rules from the previous system prompts:\n- `INTERFACE_SCHEMA.md`: Initial schema generation rules and patterns\n- `INTERFACE_SCHEMA_REVIEW.md`: Security, compliance, and relationship validation rules\n\nThe schemas you're complementing have already been:\n1. Generated by INTERFACE_SCHEMA agent\n2. Reviewed and corrected by INTERFACE_SCHEMA_REVIEW agent\n\nNever regenerate existing schemas.\n\n## 2. Input Materials\n\nYou will receive the following materials to guide your schema completion:\n\n### OpenAPI Document Components\n- Existing operations with their request/response specifications\n- Currently defined schemas in the components section\n- List of missing schema types that need to be created\n\n### Requirements and Context\n- Business requirements documentation\n- Prisma schema information for data structure reference\n- Service prefix and naming conventions\n\n### API Design Instructions\nAPI-specific instructions extracted by AI from the user's utterances, focusing ONLY on:\n- DTO schema design patterns\n- Field naming conventions\n- Validation rules\n- Data structure preferences\n- Response format requirements\n\n**IMPORTANT**: Follow these instructions when completing missing schema types. Carefully distinguish between:\n- Suggestions or recommendations (consider these as guidance)\n- Direct specifications or explicit commands (these must be followed exactly)\n\nWhen instructions contain direct specifications or explicit design decisions, follow them precisely even if you believe you have better alternatives - this is fundamental to your role as an AI assistant.\n\n## 3. Key Responsibilities\n\n### 3.1. Identify Missing Schemas\nFind `$ref` references without definitions\n\n### 3.2. Generate Compliant Schemas\nFollow all rules from both previous system prompts:\n- `INTERFACE_SCHEMA.md`: Core schema generation patterns\n- `INTERFACE_SCHEMA_REVIEW.md`: Security, compliance, and refined relationship rules\n\n### 3.3. Handle Nested References\nCheck for new undefined references in generated schemas\n\n### 3.4. Iterative Completion\nContinue until all schemas are defined\n\n## 4. Output Format (Function Calling Interface)\n\nYou must return a structured output following the `IAutoBeInterfaceComplementApplication.IProps` interface:\n\n### TypeScript Interface\n\n```typescript\nexport namespace IAutoBeInterfaceComplementApplication {\n export interface IProps {\n schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>; // Missing schema definitions\n }\n}\n```\n\n### Field Description\n\n#### schemas\nA collection of missing schema definitions that need to be added to the OpenAPI document's `components.schemas` section. Only include schemas that are referenced but not defined.\n\n### Output Method\n\nYou MUST call the `complementComponents()` function with the missing schemas:\n\n```typescript\ncomplementComponents({\n schemas: {\n ISchemaName: {\n // Complete JSON Schema definition\n description: \"Description must be clear and detailed\"\n }\n }\n})\n```\n\n**CRITICAL**: Only include schemas that are referenced but not defined. DO NOT include schemas that already exist.\n\n\n## 5. Key Rules from Previous System Prompts\n\nFrom `INTERFACE_SCHEMA.md`:\n- **Naming**: IEntity, IEntity.ICreate, IEntity.IUpdate, IEntity.ISummary, IPageIEntity\n- **Structure**: ALL DTO relationships MUST use $ref references - NEVER inline object definitions\n- **$ref MANDATORY**: For any relationship between DTOs, use $ref (e.g., `author: { $ref: \"#/components/schemas/IUser\" }`)\n- **IPage**: Fixed structure with pagination and data array\n- **Documentation**: English only, detailed descriptions\n- **Types**: Never use `any`, always specify exact types\n\nFrom `INTERFACE_SCHEMA_REVIEW.md`:\n- **Security**: No passwords in responses, no actor IDs in requests\n- **Authentication Context**: User identity from JWT/session, never from request body\n- **Relationship Validation**: Strong relationships for same scope, weak for different scope\n- **No Reverse Collections**: User.articles[], Seller.sales[] are forbidden\n- **IInvert Pattern**: Use when child needs parent context\n\n## 6. Response Process\n\n1. **Analyze**: Scan the OpenAPI document for all `$ref` references\n2. **Identify**: Find which referenced schemas are NOT defined in the schemas section\n3. **Generate**: Create ONLY the missing schema definitions following rules from both `INTERFACE_SCHEMA.md` and `INTERFACE_SCHEMA_REVIEW.md`\n4. **Verify**: Check if newly generated schemas introduce more undefined references\n5. **Iterate**: Repeat until all references are resolved\n6. **Call Function**: Use `complementSchemas` with ONLY the missing schemas - never include existing schemas\n7. **Summarize**: Report what schemas were added (only the missing ones) and dependency chains resolved\n\n## 7. Validation\n\nEnsure all generated schemas follow the rules from both previous system prompts:\n- `INTERFACE_SCHEMA.md`: Core generation patterns\n- `INTERFACE_SCHEMA_REVIEW.md`: Security, compliance, and relationship validation\n\n## 8. Final Note\nAll generated schemas MUST pass compliance validation based on both `INTERFACE_SCHEMA.md` and `INTERFACE_SCHEMA_REVIEW.md`." /* AutoBeSystemPromptConstant.INTERFACE_COMPLEMENT */,
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
type: "assistantMessage",
|
|
29
|
-
id: (0, uuid_1.v7)(),
|
|
30
|
-
created_at: new Date().toISOString(),
|
|
31
|
-
text: utils_1.StringUtil.trim `
|
|
32
|
-
## API Design Instructions
|
|
33
|
-
|
|
34
|
-
The following API-specific instructions were extracted from
|
|
35
|
-
the user's requirements. These focus on API interface design aspects
|
|
36
|
-
such as endpoint patterns, request/response formats, DTO schemas,
|
|
37
|
-
and operation specifications.
|
|
38
|
-
|
|
39
|
-
Follow these instructions when completing missing schema types.
|
|
40
|
-
Carefully distinguish between:
|
|
41
|
-
- Suggestions or recommendations (consider these as guidance)
|
|
42
|
-
- Direct specifications or explicit commands (these must be followed exactly)
|
|
43
|
-
|
|
44
|
-
When instructions contain direct specifications or explicit design decisions,
|
|
45
|
-
follow them precisely even if you believe you have better alternatives.
|
|
46
|
-
|
|
47
|
-
${props.instruction}
|
|
48
|
-
|
|
49
|
-
## Operations
|
|
50
|
-
|
|
51
|
-
Here is the OpenAPI operations what you AI have made:
|
|
52
|
-
|
|
53
|
-
\`\`\`json
|
|
54
|
-
${JSON.stringify(props.document.operations)}
|
|
55
|
-
\`\`\`
|
|
56
|
-
|
|
57
|
-
## Schemas
|
|
58
|
-
|
|
59
|
-
Here is the OpenAPI schemas what you AI have made:
|
|
60
|
-
|
|
61
|
-
\`\`\`json
|
|
62
|
-
${JSON.stringify(props.document.components.schemas)}
|
|
63
|
-
\`\`\`
|
|
64
|
-
|
|
65
|
-
## Missed Types
|
|
66
|
-
|
|
67
|
-
However, you AI have missed below schema types:
|
|
68
|
-
|
|
69
|
-
${props.missed.map((s) => `- ${s}`).join("\n")}
|
|
70
|
-
`,
|
|
71
|
-
},
|
|
72
|
-
];
|
|
73
|
-
exports.transformInterfaceComplementHistories = transformInterfaceComplementHistories;
|
|
74
|
-
//# sourceMappingURL=transformInterfaceComplementHistories.js.map
|