عرض عملي: فصل DTOs عن نماذج النطاق
في هذا الدرس 3 موضوعات
هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
stop serializing domain objects; prepares JNR-013-LAB1.
تفاصيل المخطط المبدئي
خطوة بخطوة
- Call the endpoint and see the raw
ProductJSON, including internalcostCents. - Create
ProductResponsewith only public fields. - Add a mapper method
toResponse(Product). - Planned mistake: reuse one
ProductDtofor create, update, and response; clients can then send anidor change fields they should not. Fix:CreateProductRequest,UpdateProductRequest,ProductResponse. - Rename a domain field and show the API response does not change.
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.