- docs/00-15: دراسة، بنية، محرك تعرفة، تسعير، نموذج استئجار، تكاملات، بيانات، realtime، خطة، devops، لاندنج، مخاطر، اصطلاحات سيرفر، تدفق نشر - backend/: NestJS 11 على Docker (health + tenants + عزل tenant_id + بادئة tripz_ + Redis DB 3) - apps/rider, apps/driver, dashboards/admin-web, dashboards/superadmin-web (هياكل) - sync-to-server.sh + .gitignore Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
28 lines
850 B
TypeScript
28 lines
850 B
TypeScript
import { Body, Controller, Get, Param, Post } from '@nestjs/common';
|
|
import { ApiTags } from '@nestjs/swagger';
|
|
import { TenantsService } from './tenants.service';
|
|
import { Tenant } from '../../database/entities/tenant.entity';
|
|
|
|
@ApiTags('tenants')
|
|
@Controller()
|
|
export class TenantsController {
|
|
constructor(private readonly tenants: TenantsService) {}
|
|
|
|
// للتطبيق: إعداد المستأجر الحالي عند الإقلاع.
|
|
@Get('tenant/config/:slug')
|
|
config(@Param('slug') slug: string) {
|
|
return this.tenants.config(slug);
|
|
}
|
|
|
|
// للسوبر-آدمن: إدارة كل المستأجرين (يُحمى بحارس دور لاحقاً).
|
|
@Get('admin/tenants')
|
|
list() {
|
|
return this.tenants.findAll();
|
|
}
|
|
|
|
@Post('admin/tenants')
|
|
create(@Body() body: Partial<Tenant>) {
|
|
return this.tenants.create(body);
|
|
}
|
|
}
|