Skip to content

Commit cbbddb4

Browse files
committed
fix: fix docs generation
1 parent a921354 commit cbbddb4

File tree

6 files changed

+21
-5
lines changed

6 files changed

+21
-5
lines changed

adminforth/documentation/docs/tutorial/03-Customization/06-customPages.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,9 @@ Open `index.ts` file and add the following code *BEFORE* `admin.express.serve(`
306306
307307
```ts title="/index.ts"
308308
309+
import type { IAdminUserExpressRequest } from 'adminforth';
310+
import express from 'express';
311+
309312
....
310313
311314
app.get(`${ADMIN_BASE_URL}/api/dashboard/`,

adminforth/documentation/docs/tutorial/03-Customization/08-pageInjections.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ Now create file `ApartsPie.vue` in the `custom` folder of your project:
9898
Also we have to add an Api to get percentages:
9999
100100
```ts title="./index.ts"
101+
import type { IAdminUserExpressRequest } from 'adminforth';
102+
import express from 'express';
103+
104+
....
105+
101106
app.get(`${ADMIN_BASE_URL}/api/aparts-by-room-percentages/`,
102107
admin.express.authorize(
103108
async (req: IAdminUserExpressRequest, res: express.Response) => {

adminforth/documentation/docs/tutorial/07-Plugins/01-AuditLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ Audit log is able to catch only standard actions like `create`, `update`, `delet
160160
If you have a custom, self coded actions in your API, you can log them by calling `logCustomAction` method of `AuditLogPlugin` instance:
161161
162162
```ts title="./resources/index.ts"
163+
import type { IAdminUserExpressRequest, ITranslateExpressRequest } from 'adminforth';
164+
import express from 'express';
165+
166+
....
163167

164168
app.get(`${ADMIN_BASE_URL}/api/dashboard/`,
165169
admin.express.authorize(

adminforth/documentation/docs/tutorial/07-Plugins/10-i18n.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,11 @@ onMounted(async () => {
425425
And on the backend side you can use tr function to translate the string:
426426
427427
```ts title="./index.ts"
428+
import type { IAdminUserExpressRequest, ITranslateExpressRequest } from 'adminforth';
429+
import express from 'express';
430+
431+
....
432+
428433
app.get(`${ADMIN_BASE_URL}/api/greeting`,
429434
admin.express.authorize(
430435
admin.express.translatable(

adminforth/types/Back.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,15 @@ export interface ITranslateFunction {
114114
): Promise<string>;
115115
}
116116

117-
export interface IAdminUserExpressRequest extends Request {
117+
// Omit <Request, 'param'> is used to remove 'param' method from Request type for correct docs generation
118+
export interface IAdminUserExpressRequest extends Omit<Request, 'param'> {
118119
adminUser: AdminUser;
119120
}
120121

121-
export interface ITranslateExpressRequest extends Request {
122+
export interface ITranslateExpressRequest extends Omit<Request, 'param'> {
122123
tr: ITranslateFunction;
123124
}
124125

125-
126-
127126
export interface IAdminForthSingleFilter {
128127
field?: string;
129128
operator?: AdminForthFilterOperators.EQ | AdminForthFilterOperators.NE

dev-demo/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import betterSqlite3 from 'better-sqlite3';
22
import express from 'express';
33
import AdminForth, { AdminUser, Filters } from '../adminforth/index.js';
4-
import type { IAdminUserExpressRequest, ITranslateExpressRequest } from '../adminforth/spa/src/types/Back.js';
4+
import type { IAdminUserExpressRequest, ITranslateExpressRequest } from 'adminforth';
55
import clicksResource from './resources/clicks.js';
66
import apartmentsResource from './resources/apartments.js';
77
import apartmentBuyersResource from './resources/apartment_buyers.js';

0 commit comments

Comments
 (0)