Skip to content
This repository was archived by the owner on Jun 28, 2025. It is now read-only.

Commit 3e170e3

Browse files
committed
fix(cms): Fix the tabs in users.ts
1 parent b136376 commit 3e170e3

File tree

1 file changed

+44
-44
lines changed

1 file changed

+44
-44
lines changed

cms/src/config/seed/users.ts

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,53 @@
11
// Define a type for the strapi parameter
22
interface Strapi {
3-
entityService: {
4-
count: (query: string) => Promise<number>;
5-
create: (query: string, data: { data: User }) => Promise<void>;
6-
};
3+
entityService: {
4+
count: (query: string) => Promise<number>;
5+
create: (query: string, data: { data: User }) => Promise<void>;
6+
};
77
}
88

99
// Define a type for the user object
1010
interface User {
11-
username: string;
12-
email: string;
13-
provider: string;
14-
password: string;
15-
resetPasswordToken: null;
16-
confirmationToken: null;
17-
confirmed: boolean;
18-
blocked: boolean;
19-
role: number;
20-
old_pw_hash: null;
21-
migrated_pw: boolean;
11+
username: string;
12+
email: string;
13+
provider: string;
14+
password: string;
15+
resetPasswordToken: null;
16+
confirmationToken: null;
17+
confirmed: boolean;
18+
blocked: boolean;
19+
role: number;
20+
old_pw_hash: null;
21+
migrated_pw: boolean;
2222
}
2323

2424
export async function seedUsers(strapi: Strapi) {
25-
const amountOfUsers = 10;
26-
try {
27-
const count = await strapi.entityService.count("plugin::users-permissions.user");
28-
if (count === 0) {
29-
for (let i = 0; i < amountOfUsers; i++) {
30-
const user: User = {
31-
username: `dummyUser${i}`,
32-
email: `dummyUser${i}@example.com`,
33-
provider: "local",
34-
password: "dummyPassword",
35-
resetPasswordToken: null,
36-
confirmationToken: null,
37-
confirmed: true,
38-
blocked: false,
39-
role: 1,
40-
old_pw_hash: null,
41-
migrated_pw: false,
42-
};
43-
await strapi.entityService.create("plugin::users-permissions.user", { data: user });
44-
}
45-
console.log("SUCCESS: Created user on bootstrap");
46-
} else {
47-
console.log("INFO: User have already been created on bootstrap");
48-
}
49-
} catch (err) {
50-
console.log("ERROR: Could not create users on bootstrap");
51-
console.log(err);
52-
}
53-
}
25+
const amountOfUsers = 10;
26+
try {
27+
const count = await strapi.entityService.count("plugin::users-permissions.user");
28+
if (count === 0) {
29+
for (let i = 0; i < amountOfUsers; i++) {
30+
const user: User = {
31+
username: `dummyUser${i}`,
32+
email: `dummyUser${i}@example.com`,
33+
provider: "local",
34+
password: "dummyPassword",
35+
resetPasswordToken: null,
36+
confirmationToken: null,
37+
confirmed: true,
38+
blocked: false,
39+
role: 1,
40+
old_pw_hash: null,
41+
migrated_pw: false,
42+
};
43+
await strapi.entityService.create("plugin::users-permissions.user", { data: user });
44+
}
45+
console.log("SUCCESS: Created user on bootstrap");
46+
} else {
47+
console.log("INFO: User have already been created on bootstrap");
48+
}
49+
} catch (err) {
50+
console.log("ERROR: Could not create users on bootstrap");
51+
console.log(err);
52+
}
53+
}

0 commit comments

Comments
 (0)