add accountCreated
This commit is contained in:
parent
9528624f95
commit
928e283b3c
|
@ -106,6 +106,7 @@ export async function createNewUser(input: {
|
||||||
password,
|
password,
|
||||||
level: "basic",
|
level: "basic",
|
||||||
tests: [],
|
tests: [],
|
||||||
|
accountCreated: now,
|
||||||
lastLogin: now,
|
lastLogin: now,
|
||||||
lastActive: now,
|
lastActive: now,
|
||||||
userTextOptionsRecord: undefined,
|
userTextOptionsRecord: undefined,
|
||||||
|
@ -124,6 +125,7 @@ export async function createNewUser(input: {
|
||||||
[input.strategy]: input.profile,
|
[input.strategy]: input.profile,
|
||||||
level: "basic",
|
level: "basic",
|
||||||
tests: [],
|
tests: [],
|
||||||
|
accountCreated: now,
|
||||||
lastLogin: now,
|
lastLogin: now,
|
||||||
lastActive: now,
|
lastActive: now,
|
||||||
userTextOptionsRecord: undefined,
|
userTextOptionsRecord: undefined,
|
||||||
|
@ -146,6 +148,7 @@ export async function createNewUser(input: {
|
||||||
lastLogin: now,
|
lastLogin: now,
|
||||||
tests: [],
|
tests: [],
|
||||||
lastActive: now,
|
lastActive: now,
|
||||||
|
accountCreated: now,
|
||||||
level: "basic",
|
level: "basic",
|
||||||
userTextOptionsRecord: undefined,
|
userTextOptionsRecord: undefined,
|
||||||
}
|
}
|
||||||
|
@ -163,6 +166,7 @@ export async function createNewUser(input: {
|
||||||
lastLogin: now,
|
lastLogin: now,
|
||||||
tests: [],
|
tests: [],
|
||||||
lastActive: now,
|
lastActive: now,
|
||||||
|
accountCreated: now,
|
||||||
level: "basic",
|
level: "basic",
|
||||||
userTextOptionsRecord: undefined,
|
userTextOptionsRecord: undefined,
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,7 +151,9 @@ const authRouter = (passport: PassportStatic) => {
|
||||||
if (!req.user || !req.user.admin) {
|
if (!req.user || !req.user.admin) {
|
||||||
return res.redirect("/");
|
return res.redirect("/");
|
||||||
}
|
}
|
||||||
const users = await getAllLingdocsUsers();
|
const users = (await getAllLingdocsUsers()).sort((a, b) => (
|
||||||
|
(a.accountCreated || 0) - (b.accountCreated || 0)
|
||||||
|
));
|
||||||
res.render("admin", { users });
|
res.render("admin", { users });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
next(e);
|
next(e);
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
<th scope="col">Email</th>
|
<th scope="col">Email</th>
|
||||||
<th scope="col">Providers</th>
|
<th scope="col">Providers</th>
|
||||||
<th scope="col">Level</th>
|
<th scope="col">Level</th>
|
||||||
<th scope="col">Tests</th>
|
<th scope="col">Joined</th>
|
||||||
<th shope="col"></th>
|
<th shope="col"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
@ -88,6 +88,9 @@
|
||||||
<%= users[i].level %>
|
<%= users[i].level %>
|
||||||
<% } %>
|
<% } %>
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
<%= users[i].accountCreated %>
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button class="btn btn-sm btn-danger" onClick="handleDeleteUser('<%= users[i].userId %>', '<%= users[i].name %>')"><i class="fa fa-trash"></i></button>
|
<button class="btn btn-sm btn-danger" onClick="handleDeleteUser('<%= users[i].userId %>', '<%= users[i].name %>')"><i class="fa fa-trash"></i></button>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -47,6 +47,7 @@ export type LingdocsUser = {
|
||||||
},
|
},
|
||||||
upgradeToStudentRequest?: "waiting" | "denied",
|
upgradeToStudentRequest?: "waiting" | "denied",
|
||||||
tests: TestResult[],
|
tests: TestResult[],
|
||||||
|
accountCreated?: TimeStamp,
|
||||||
lastLogin: TimeStamp,
|
lastLogin: TimeStamp,
|
||||||
lastActive: TimeStamp,
|
lastActive: TimeStamp,
|
||||||
userTextOptionsRecord: undefined | UserTextOptionsRecord,
|
userTextOptionsRecord: undefined | UserTextOptionsRecord,
|
||||||
|
|
Loading…
Reference in New Issue