Skip to content

Commit 6976b2f

Browse files
author
Petr Kachanovsky
committed
change users config file name to adminuser
1 parent a6cb227 commit 6976b2f

File tree

12 files changed

+30
-30
lines changed

12 files changed

+30
-30
lines changed

adminforth/commands/createApp/templates/index.ts.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import express from 'express';
22
import AdminForth, { Filters } from 'adminforth';
3-
import usersResource from "./resources/users";
3+
import usersResource from "./resources/adminuser";
44

55
const ADMIN_BASE_URL = '';
66

adminforth/commands/createApp/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ async function writeTemplateFiles(dirname, cwd, options) {
191191
data: { dbUrl, prismaDbUrl },
192192
},
193193
{
194-
src: 'users.ts.hbs',
195-
dest: 'resources/users.ts',
194+
src: 'adminuser.ts.hbs',
195+
dest: 'resources/adminuser.ts',
196196
data: {},
197197
},
198198
{

adminforth/documentation/blog/2024-10-01-ai-blog/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,9 @@ if (import.meta.url === `file://${process.argv[1]}`) {
325325

326326
## Step 5: Create resources
327327

328-
Create `res` folder. Create `./res/user.ts` file with following content:
328+
Create `res` folder. Create `./res/adminuser.ts` file with following content:
329329

330-
```ts title="./res/users.ts"
330+
```ts title="./res/adminuser.ts"
331331
import AdminForth, { AdminForthDataTypes } from 'adminforth';
332332
import { randomUUID } from 'crypto';
333333
import UploadPlugin from '@adminforth/upload';

adminforth/documentation/docs/tutorial/001-gettingStarted.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ myadmin/
6464
│ ├── package.json # For any custom npm packages you will use in Vue files
6565
│ └── tsconfig.json # Tsconfig for Vue project (adds completion for AdminForth core components)
6666
├── resources
67-
│ └── users.ts # Example resource file for users management
67+
│ └── adminuser.ts # Example resource file for users management
6868
├── schema.prisma # Prisma schema file for database schema
6969
├── index.ts # Main entry point: configures AdminForth & starts the server
7070
├── package.json # Project dependencies

adminforth/documentation/docs/tutorial/03-Customization/03-virtualColumns.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Another usecase of `virtual` columns is to add new fields in edit and create vie
8484
Thing is that password itself can't be stored in the database, but instead their hash is stored.
8585
So we need to add `password` field to the `adminuser` resource and make it `virtual` so it will not be stored in the database.
8686
87-
```ts title="./resources/users.ts"
87+
```ts title="./resources/adminuser.ts"
8888
...
8989
resourceId: 'adminuser',
9090
...

adminforth/documentation/docs/tutorial/03-Customization/05-limitingAccess.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ You can use `options.allowedActions` on resource to limit access to the resource
1515

1616
If you want to disable deletion of the resource records for all users:
1717

18-
```ts title="./resources/users.ts"
18+
```ts title="./resources/adminuser.ts"
1919
{
2020
...
2121
resourceId: 'adminuser',
@@ -69,7 +69,7 @@ import type { AdminUser } from 'adminforth';
6969

7070
Let's disable creating and editing of new users for all users apart from users with role `superadmin`, and at the same time disable deletion for all users:
7171

72-
```ts title="./resources/users.ts"
72+
```ts title="./resources/adminuser.ts"
7373
//diff-add
7474
import type { AdminUser } from 'adminforth';
7575

adminforth/documentation/docs/tutorial/03-Customization/13-standardPagesTuning.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ export default {
346346
In cases when column values must follow certain format, you can add `validation` to it.
347347
`validation` is an array of rules, each containing `regExp` that defines a format for a value and `message` that will be displayed in case when entered value does not pass the check.
348348

349-
```typescript title="./resources/users.ts"
349+
```typescript title="./resources/adminuser.ts"
350350
export default {
351351
name: 'adminuser',
352352
columns: [
@@ -374,7 +374,7 @@ export default {
374374

375375
You can add `editingNote` to a column to show a note below the input field.
376376

377-
```typescript title="./resources/users.ts"
377+
```typescript title="./resources/adminuser.ts"
378378
export default {
379379
name: 'adminuser',
380380
columns: [
@@ -393,7 +393,7 @@ export default {
393393

394394
Whenever you want to have a column to store not a single value but an array of values you have to set column as `AdminForthDataTypes.JSON`. This way when you are creating or editing a record you can type in a JSON array into a textfield. To simplify this process and allow you to create and edit separate items you can add `isArray` to a column.
395395

396-
```typescript title="./resources/users.ts"
396+
```typescript title="./resources/adminuser.ts"
397397
export default {
398398
name: 'adminuser',
399399
columns: [
@@ -422,7 +422,7 @@ Doing so, will result in UI displaying each item of the array as a separate inpu
422422

423423
By default it is forbidden to store duplicate values in an array column. To change that you can add `allowDuplicateItems: true` to `isArray`, like so:
424424

425-
```typescript title="./resources/users.ts"
425+
```typescript title="./resources/adminuser.ts"
426426
export default {
427427
name: 'adminuser',
428428
columns: [
@@ -452,7 +452,7 @@ Note: array columns can not be marked as `masked`, be a `primaryKey` and at the
452452

453453
When you want to create a connection between two resources, you need to add `foreignResource` to a column, like so:
454454

455-
```typescript title="./resources/users.ts"
455+
```typescript title="./resources/adminuser.ts"
456456
export default {
457457
name: 'adminuser',
458458
columns: [

adminforth/documentation/docs/tutorial/05-Plugins/02-TwoFactorsAuth.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ npm i @adminforth/two-factors-auth --save
1010

1111
Plugin is already installed into adminforth, to import:
1212

13-
```ts title="/users.ts"
13+
```ts title="/adminuser.ts"
1414
import TwoFactorsAuthPlugin from '@adminforth/two-factors-auth';
1515
```
1616

1717
Plugin required some additional setup, to make it work properly. It should be added to the resource auth resource. In our example we will add it to the user resource .
1818

1919
```ts title='./schema.prisma'
20-
model users {
20+
model adminuser {
2121
id String @id
2222
created_at DateTime
2323
email String @unique
@@ -34,9 +34,9 @@ Then:
3434
npx --yes prisma migrate dev --name init
3535
```
3636
37-
And add it to `users.ts`
37+
And add it to `adminuser.ts`
3838
39-
```ts tittle="./resources/users.ts"
39+
```ts tittle="./resources/adminuser.ts"
4040
{
4141
table: 'adminuser',
4242
//diff-add
@@ -108,7 +108,7 @@ By default plugin enforces Two-Factor Authentication for all users.
108108
109109
If you wish to enforce 2FA only for specific users, you can again use `usersFilterToApply` option:
110110
111-
```ts title='./users.ts'
111+
```ts title='./adminuser.ts'
112112
usersFilterToApply: (adminUser: AdminUser) => {
113113
// disable 2FA for users which email is 'adminforth' or 'adminguest'
114114
return !(['adminforth', 'adminguest'].includes(adminUser.dbUser.email));
@@ -117,7 +117,7 @@ If you wish to enforce 2FA only for specific users, you can again use `usersFilt
117117
118118
You can even add a boolean column to the user table to store whether the user should use 2FA or not:
119119
120-
```ts title='./users.ts'
120+
```ts title='./adminuser.ts'
121121
{
122122
resourceId: 'adminuser',
123123
...
@@ -162,7 +162,7 @@ By default, all users are required to setup Two-Factor Authentication.
162162
163163
If you want to allow specific users to skip the 2FA setup, you can use the `usersFilterToAllowSkipSetup` option:
164164
165-
```ts title='./users.ts'
165+
```ts title='./adminuser.ts'
166166
...
167167
plugins: [
168168
new TwoFactorsAuthPlugin ({

adminforth/documentation/docs/tutorial/05-Plugins/03-ForeignInlineList.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Import plugin:
1010
npm i @adminforth/foreign-inline-list --save
1111
```
1212

13-
```ts title="./resources/users.ts"
13+
```ts title="./resources/adminuser.ts"
1414
import ForeignInlineListPlugin from '@adminforth/foreign-inline-list';
1515
import { AdminForthResource, AdminForthResourceColumn } from 'adminforth';
1616
```
@@ -42,7 +42,7 @@ This means that we can display a list of apartments in the user's show view.
4242
Add to your `'adminuser'` resource configuration the plugin instance:
4343

4444

45-
```ts title="./resources/users.ts"
45+
```ts title="./resources/adminuser.ts"
4646
{
4747
...
4848
resourceId: 'adminuser',

0 commit comments

Comments
 (0)