#P1776
GET /v2/config
Initial System Configuration
این متد نقطه شروع (Entry Point) اپلیکیشن است. فرانتاند قبل از هر کاری باید این اندپوینت را صدا بزند.
سیستم با بررسی هدر Domain، شعبه (Office) مورد نظر را پیدا کرده و تمام تنظیمات حیاتی شامل رنگبندی، لوگو، اطلاعات تماس، قوانین مالی و وضعیت بدهی را برمیگرداند.
Get Tenant Config
URL:
/v2/configMethod: GET
Controller: V2BaseController@config
Auth: Public (نیاز به توکن ندارد)
Headers (الزامی)
| Header Name | Description |
|---|---|
| Domain | آدرس دامنهای که کاربر با آن سایت را باز کرده است. مثال: crm.travel-agency.com یا localhost:3000 سیستم به صورت خودکار www. و پورت را حذف میکند. |
Response Structure
| Field Block | Description |
|---|---|
| office_id | شناسه واقعی شعبه + 1000 (جهت امنیت و عدم نمایش ID اصلی). |
| design | تنظیمات UI/UX:
|
| details.financial_debt | مهم: (Boolean) اگر true باشد، یعنی شعبه فاکتور پرداخت نشده "پشتیبانی" (Support Bill) دارد و دسترسی باید محدود شود. |
| details.official | قوانین هاردکد شده (Hardcoded) مربوط به سیستم حضور و غیاب:
|
| details.config | تنظیمات داینامیک تعریف شده در جدول office_config. خروجی به صورت Key-Value است (مثلاً allow_negative_stock: "1"). |
Example Response
{
"office_id": 1005,
"title": {
"fa": "آژانس مسافرتی آسمان",
"en": "Aseman Travel Agency"
},
"brand": {
"fa": "آسمان",
"en": "Aseman"
},
"short_domain": "aseman",
"expiration": "2025-12-29",
"communicational": {
"phone": "021-44444444",
"mobile": "09121234567",
"address": {
"fa": "تهران، میدان آزادی...",
"en": "Tehran, Azadi Sq..."
},
"location": "35.6892,51.3890"
},
"design": {
"login_text": "به سیستم اتوماسیون خوش آمدید",
"logo": "https://storage.../logo.png",
"base_color": "#ff5722",
"theme": "dark"
},
"support_online": {
"service": "raychat",
"code": "e45-fgh-789"
},
"details": {
"financial_debt": false,
"financial": {
"value_added": 9
},
"official": {
"calendar_limit": {
"leave": {
"1": { "overtime": -60, "substitute": true },
"2": { "overtime": -60, "substitute": false }
}
}
},
"config": {
"print_header": "1",
"currency_default": "IRR"
}
}
}
Logic Flow
Request (Header: Domain)
↓
Domain Parsing
Remove 'www.', Remove Port
Extract Base Domain
Remove 'www.', Remove Port
Extract Base Domain
↓
Exists in DB?
(table: offices)
(table: offices)
No ↙
400 Bad Request
"The office is not defined"
"The office is not defined"
Yes ↘
Load Data
1. Configs (office_config)
2. VAT (accounting_titles)
3. Debt Check (airplus_bills)
4. Redis Cache Update
1. Configs (office_config)
2. VAT (accounting_titles)
3. Debt Check (airplus_bills)
4. Redis Cache Update
↓
Return JSON Config