feat: add admin subscription granting feature

- Implemented the ability for admins to grant subscriptions to doctors and clinics without payment.
- Added new API endpoint `/api/v1/admin/subscription/grant` for granting subscriptions.
- Updated the subscription model to track the admin who granted the subscription.
- Enhanced the subscription report to include details about granted subscriptions.
- Introduced a new `is_granted` field to indicate if a subscription was granted by an admin.
- Updated the database schema to support the new functionality with a migration.
- Added tests to ensure the correct behavior of the subscription granting process.
This commit is contained in:
hamed
2026-08-09 13:43:30 +03:30
parent 60ccd5cc1d
commit a6a965a2aa
10 changed files with 874 additions and 29 deletions
@@ -26,6 +26,14 @@ interface Props {
ariaLabel?: string;
/** اگر label قابل‌مشاهده‌ای وجود دارد، id آن را بده (بر ariaLabel اولویت دارد). */
ariaLabelledBy?: string;
/**
* جستجوی سمت سرور: با هر تایپ صدا زده می‌شود تا مصرف‌کننده `options` تازه بدهد.
*
* وقتی داده می‌شود، فیلترِ داخلی react-select خاموش می‌شود؛ وگرنه نتیجهٔ سرور
* دوباره روی متنِ تایپ‌شده فیلتر می‌شد و گزینه‌هایی که سرور با معیارِ دیگری
* (مثلاً شمارهٔ موبایل) پیدا کرده بود ناپدید می‌شدند.
*/
onInputChange?: (input: string) => void;
}
export default function SearchableSelect({
@@ -41,6 +49,7 @@ export default function SearchableSelect({
height = 42,
ariaLabel,
ariaLabelledBy,
onInputChange,
}: Props) {
const darkMode = useUiStore((s) => s.darkMode);
@@ -121,6 +130,12 @@ export default function SearchableSelect({
isLoading={isLoading}
isDisabled={isDisabled}
isClearable={isClearable}
onInputChange={onInputChange ? (input, meta) => {
// react-select ورودی را هنگام بستن منو و blur هم «تغییر» می‌داند؛ آن دو را
// رد نکنیم، هر بار بستنِ منو لیست را به حالت خالی برمی‌گرداند.
if (meta.action === 'input-change') { onInputChange(input); }
} : undefined}
filterOption={onInputChange ? null : undefined}
styles={styles}
isRtl
menuPortalTarget={typeof document !== 'undefined' ? document.body : undefined}