feat(dimentorin): materials module (CRUD konten mentoring, public+protected routes)

- app_materials table: mentor_id, title, slug, category, description, content
- domain/application/infrastructure pola articles: repo postgres, service, DTO ZodValidate
- routes: GET /materials (public, published only), GET /materials/{id|slug|categories}, POST/PUT/DELETE (auth, author-only)
- verified e2e: create 3 materi sebagai mentor, list, slug, categories
This commit is contained in:
asepharyana
2026-08-05 17:01:59 +07:00
parent b4a9972ad7
commit ac8177d87e
19 changed files with 801 additions and 3 deletions
+8 -3
View File
@@ -6,9 +6,9 @@ use imphnen_cms::{
roadmap_public_routes, testimonials_protected_routes, testimonials_public_routes,
};
use imphnen_dimentorin::{
articles_protected_routes, articles_public_routes, mentors_protected_routes,
mentors_public_routes, payments_protected_routes, sessions_protected_routes,
sessions_public_routes,
articles_protected_routes, articles_public_routes, materials_protected_routes,
materials_public_routes, mentors_protected_routes, mentors_public_routes,
payments_protected_routes, sessions_protected_routes, sessions_public_routes,
};
use imphnen_gacha::gacha_router;
use imphnen_hackathon::hackathon_router;
@@ -76,6 +76,7 @@ pub async fn gateway_service(postgres_clients: PostgresClients) -> Router {
.merge(mentors_public_routes(db.clone(), Arc::clone(&state_arc)))
.merge(sessions_public_routes(db.clone()))
.merge(articles_public_routes(db.clone()))
.merge(materials_public_routes(db.clone()))
.merge(
Router::new()
.merge(mentors_protected_routes(db.clone(), Arc::clone(&state_arc)))
@@ -85,6 +86,10 @@ pub async fn gateway_service(postgres_clients: PostgresClients) -> Router {
db.clone(),
Arc::clone(&state_arc),
))
.merge(materials_protected_routes(
db.clone(),
Arc::clone(&state_arc),
))
.layer(from_fn(auth_middleware)),
);