-
Notifications
You must be signed in to change notification settings - Fork 1
/
api-service.ar.md
180 lines (122 loc) · 5.75 KB
/
api-service.ar.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
## الخدمة الخلفية (NestJS)
<a href="./api-service.md">
<img alt="Translation" src="https://img.shields.io/badge/Bahasa_Indonesia-blue?style=for-the-badge&logo=googletranslate&logoColor=blue&labelColor=white">
</a>
<a href="./api-service.en.md">
<img alt="Translation" src="https://img.shields.io/badge/English-blue?style=for-the-badge&logo=googletranslate&logoColor=blue&labelColor=white">
</a>
<a href="./api-service.zh-CN.md">
<img alt="Translation" src="https://img.shields.io/badge/简体中文-blue?style=for-the-badge&logo=googletranslate&logoColor=blue&labelColor=white">
</a>
<a href="./api-service.ja.md">
<img alt="Translation" src="https://img.shields.io/badge/日本語-blue?style=for-the-badge&logo=googletranslate&logoColor=blue&labelColor=white">
</a>
<a href="./api-service.ar.md">
<img alt="Translation" src="https://img.shields.io/badge/Arabic_عربي-blue?style=for-the-badge&logo=googletranslate&logoColor=blue&labelColor=white">
</a>
<a href="./api-service.pt.md">
<img alt="Translation" src="https://img.shields.io/badge/Português-blue?style=for-the-badge&logo=googletranslate&logoColor=blue&labelColor=white">
</a>
<a href="./api-service.es.md">
<img alt="Translation" src="https://img.shields.io/badge/Español-blue?style=for-the-badge&logo=googletranslate&logoColor=blue&labelColor=white">
</a>
<a href="./api-service.fr.md">
<img alt="Translation" src="https://img.shields.io/badge/Français-blue?style=for-the-badge&logo=googletranslate&logoColor=blue&labelColor=white">
</a>
<a href="./api-service.vi.md">
<img alt="Translation" src="https://img.shields.io/badge/Tiếng_Việt-blue?style=for-the-badge&logo=googletranslate&logoColor=blue&labelColor=white">
</a>
<a href="./api-service.hi.md">
<img alt="Translation" src="https://img.shields.io/badge/Hindi_हिंदी-blue?style=for-the-badge&logo=googletranslate&logoColor=blue&labelColor=white">
</a>
يتضمن تطبيق لوحة الإدارة
apps/api
apps/admin-panel
### متطلبات النظام
تأكد من أن نظامك يلبي المتطلبات التالية قبل بدء التثبيت:
- Node.js v18 أو أعلى
- PostgreSQL 15 أو أعلى
- ريديس v5 أو أعلى
### خطوات التثبيت
1. استنساخ/استخراج المستودع
2. تثبيت التبعيات:
```bash
npm i
```
#### بيئة الإعداد
- إعادة تسمية`.env.example`ل`.env`
#### قاعدة بيانات الإعداد
- يرتب`DATABASE_URL`ل`.env`
```sh
DATABASE_URL="postgresql:https://<username>:<password>@<host>:5432/<db-name>?schema=public"
# example
DATABASE_URL="postgresql:https://postgres:postgre123@localhost:5432/backtix?schema=public"
```
- قم بتشغيل الترحيل لإنشاء الجداول المطلوبة
```bash
npx prisma migrate deploy
```
- قم بتشغيل بذارة قاعدة البيانات لإنشاء مستخدمين`superadmin`
```bash
npm run db:seed
```
#### يثبت**تسجيل الدخول جوجل**معرف الخادم والعميل
- إنشاء مشروع جديد في[جوجل السحابية وحدة التحكم](https://console.cloud.google.com/projectcreate)
- بمجرد الانتهاء من إنشاء المشروع، حدده`APIs & Services`، ثم حدد`OAuth consent screen`على الجانب الأيسر
- أدخل اسم التطبيق والبريد الإلكتروني و`Developer contact information`
![Cloud Console](/assets/Screenshot_1.png)
- **الخادم**معرف العميل
- يختار`Credentials`في الشريط الجانبي الأيسر، انقر فوق`CREATE CREDENTIALS`، يختار`OAuth client ID`
![Cloud Console](/assets/Screenshot_2.png)
- يختار`Web application`نوع التطبيق، بيري ناما لالو حفظ/إنشاء
![Cloud Console](/assets/Screenshot_3.png)
- ترجمة`Client ID`و`Client secret`أعطيت`.env`
```sh
# google oauth
SERVER_GOOGLE_CLIENT_ID=
SERVER_GOOGLE_CLIENT_SECRET=
```
- **التطبيق على شبكة الإنترنت**معرف العميل
- `CREATE CREDENTIALS`العودة، حدد`OAuth client ID`
- يختار`Web application`نوع التطبيق، وإعطاء اسم و`Authorized JavaScript origins`كما في الصورة (إذا كنت تستخدم المضيف المحلي)، ثم احفظ/أنشئ
![Cloud Console](/assets/Screenshot_4.png)
- ترجمة`Client ID`و`Client secret`أعطيت`.env`
```sh
# optional web only
WEB_APP_GOOGLE_CLIENT_ID=
WEB_APP_GOOGLE_CLIENT_SECRET=
```
- انقر`DOWNLOAD JSON`وحفظ معرف العميل. سيتم استخدام معرف عميل الويب في تطبيق Flutter للجوال.
#### إعداد خادم midtrans ومفتاح العميل
- اذهب إلى[لوحة القيادة ميدترانس](https://dashboard.midtrans.com/)، حدد البيئة`sandbox`(مستحسن) أو`production`
- أدخل إلى`Settings`>`Access Keys`، ثم انسخ مفاتيح العميل والخادم إلى الملف`.env`
```sh
# sandbox
MIDTRANS_URL=https://app.sandbox.midtrans.com/snap/v1/transactions
# production
MIDTRANS_URL=https://app.midtrans.com/snap/v1/transactions
MIDTRANS_SERVER_KEY=
MIDTRANS_CLIENT_KEY=
```
- التكوين المتغير`.env`أخرى حسب الحاجة.
### كيف تركض
1. يولد`metadata`:
```bash
npm run metadata --workspace=@backtix-service/api
```
2. تشغيل التطبيق
```bash
npm run start
```
- وضع التنمية
```bash
npm run start:dev
```
2. مستندات Swagger API
- افتح http://localhost:3000/api/docs (اضبط عنوان URL الأساسي)
3. اختبار (اختياري)
```bash
npm test
```
### لقطات الشاشة
![Swagger API Docs](/assets/swagger.png)