Page MenuHomeSealhub

users.ts
No OneTemporary

users.ts

import { Collection, App } from "../../main";
module.exports = (app: App) => {
app.on("started", async () => {
const sealious_response = await app.runAction(
new app.Sealious.SuperContext(),
["collections", "users"],
"show",
{ filter: { email: app.manifest.admin_email } }
);
if (sealious_response.empty) {
app.Logger.warning(
`Creating an admin account for ${app.manifest.admin_email}`
);
return app.runAction(
new app.Sealious.SuperContext(),
["collections", "registration-intents"],
"create",
{ email: app.manifest.admin_email, role: "admin" }
);
}
});
return Collection.fromDefinition(app, {
name: "users",
fields: [
{
name: "username",
type: "username",
required: true,
},
{
name: "email",
type: "email",
required: true,
},
{
name: "password",
type: "password",
params: {
min_length: 6,
},
required: true,
},
{
name: "status",
type: "text",
},
{
name: "last_login_context",
type: "context",
},
{
name: "roles",
type: "reverse-single-reference",
params: {
collection: "user-roles",
field_name: "user",
},
},
],
access_strategy: {
default: "public",
show: "themselves",
},
});
};

File Metadata

Mime Type
text/x-java
Expires
Tue, Dec 24, 14:04 (11 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
557274
Default Alt Text
users.ts (1 KB)

Event Timeline