CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/lib/api/schema/accounts/common.ts
Views: 688
1
import { z } from "../../framework";
2
3
export const AccountIdSchema = z.string().uuid().describe("Account id.");
4
5
export type AccountId = z.infer<typeof AccountIdSchema>;
6
7
export const AdminAccountIdSchema = AccountIdSchema.optional().describe(
8
`**Administrators only**. Optional account id to set name(s) for. If this field is
9
not provided, it is assumed that this operation pertains to the account id of the
10
user making the request.`,
11
);
12
13
export type AdminAccountId = z.infer<typeof AdminAccountIdSchema>;
14
15
export const AccountEmailSchema = z
16
.string()
17
.describe("The account e-mail address.");
18
19
export type AccountEmail = z.infer<typeof AccountEmailSchema>;
20
21
export const AccountUserSchema = z
22
.object({
23
account_id: AccountIdSchema,
24
first_name: z.string().describe("User's first name.").nullish(),
25
last_name: z.string().describe("User's last name.").nullish(),
26
name: z.string().describe("Customizable username").nullish(),
27
last_active: z
28
.number()
29
.min(0)
30
.nullable()
31
.describe(
32
"UNIX timestamp indicating time at which the account was last active.",
33
),
34
created: z
35
.number()
36
.min(0)
37
.describe(
38
"UNIX timestamp indicating time at which the account was created.",
39
),
40
banned: z
41
.boolean()
42
.optional()
43
.describe("**Administrators only**. True if this user has been banned."),
44
email_address_verified: z
45
.boolean()
46
.nullish()
47
.describe("Set to `true` once the user's e-mail has been verified."),
48
email_address: AccountEmailSchema.optional().describe(
49
`The account e-mail address.
50
51
*Note*: For security reasons, the email_address *only* occurs in search queries
52
that are by \`email_address\` (or for admins); email addresses of users queried
53
by substring searches are not revealed.`,
54
),
55
})
56
.describe("User account.");
57
58
export type AccountUser = z.infer<typeof AccountUserSchema>;
59
60