data display on clientSide
This commit is contained in:
+3
-5
@@ -11,7 +11,6 @@ async function main() {
|
||||
await prisma.post.deleteMany();
|
||||
await prisma.profile.deleteMany();
|
||||
|
||||
|
||||
// Create 5 users
|
||||
const users = [];
|
||||
for (let i = 0; i < 5; i++) {
|
||||
@@ -28,12 +27,11 @@ async function main() {
|
||||
role: i === 0 ? 'ADMIN' : i === 1 ? 'EDITOR' : 'USER',
|
||||
},
|
||||
});
|
||||
|
||||
users.push(user);
|
||||
console.log(`User created: ${user.username}`);
|
||||
}
|
||||
|
||||
|
||||
// Each user creates 2-4 posts
|
||||
for (const user of users) {
|
||||
const postCount = faker.number.int({ min: 2, max: 4 });
|
||||
for (let i = 0; i < postCount; i++) {
|
||||
@@ -45,11 +43,11 @@ async function main() {
|
||||
authorId: user.id,
|
||||
},
|
||||
});
|
||||
console.log(`Created post: ${post.title}`);
|
||||
console.log(`Post created: ${post.title}`);
|
||||
}
|
||||
}
|
||||
|
||||
for (const user of users){
|
||||
for (const user of users) {
|
||||
const profile = await prisma.profile.create({
|
||||
data: {
|
||||
bio: faker.person.bio(),
|
||||
|
||||
Generated
+1008
File diff suppressed because it is too large
Load Diff
+13
-5
@@ -23,12 +23,20 @@ async function fetchAndDisplayData() {
|
||||
${data.map(item => `
|
||||
<li>
|
||||
<h2>${item.name}</h2>
|
||||
<strong>Role: </strong>${item.role}<br>
|
||||
<strong>Email: </strong>${item.email}<br>
|
||||
</li>`
|
||||
).join('')}
|
||||
<strong>Role:</strong> ${item.role}<br>
|
||||
<strong>Email:</strong> ${item.email}<br>
|
||||
<strong>Username:</strong> ${item.username}<br>
|
||||
<strong>UUID:</strong> ${item.userId}<br>
|
||||
<strong>Avatar:</strong>${item.avatar}<br>
|
||||
<strong>Initial Password:</strong> ${item.password}<br>
|
||||
<strong>Birthdate:</strong> ${new Date(item.birthdate).toDateString()}<br>
|
||||
<strong>Profile Bio:</strong> ${item.profile?.bio || 'N/A'}<br><br>
|
||||
<ul>
|
||||
</ul>
|
||||
`
|
||||
</li>
|
||||
`).join('')}
|
||||
</ul>
|
||||
`
|
||||
dataContainer.innerHTML = html;
|
||||
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user