mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
refactor auth/media entities to separate files, suppress node:sqlite warning
This commit is contained in:
@@ -3,12 +3,13 @@ import type { PasswordStrategy } from "auth/authenticate/strategies";
|
||||
import type { DB } from "core";
|
||||
import { $console, secureRandomString, transformObject } from "core/utils";
|
||||
import type { Entity, EntityManager } from "data";
|
||||
import { em, entity, enumm, type FieldSchema, text } from "data/prototype";
|
||||
import { em, entity, enumm, type FieldSchema } from "data/prototype";
|
||||
import { Module } from "modules/Module";
|
||||
import { AuthController } from "./api/AuthController";
|
||||
import { type AppAuthSchema, authConfigSchema, STRATEGIES } from "./auth-schema";
|
||||
import { AppUserPool } from "auth/AppUserPool";
|
||||
import type { AppEntity } from "core/config";
|
||||
import { usersFields } from "./auth-entities";
|
||||
|
||||
export type UserFieldSchema = FieldSchema<typeof AppAuth.usersFields>;
|
||||
declare module "core" {
|
||||
@@ -125,18 +126,7 @@ export class AppAuth extends Module<typeof authConfigSchema> {
|
||||
return this.em.entity(entity_name) as any;
|
||||
}
|
||||
|
||||
static usersFields = {
|
||||
email: text().required(),
|
||||
strategy: text({
|
||||
fillable: ["create"],
|
||||
hidden: ["update", "form"],
|
||||
}).required(),
|
||||
strategy_value: text({
|
||||
fillable: ["create"],
|
||||
hidden: ["read", "table", "update", "form"],
|
||||
}).required(),
|
||||
role: text(),
|
||||
};
|
||||
static usersFields = usersFields;
|
||||
|
||||
registerEntities() {
|
||||
const users = this.getUsersEntity(true);
|
||||
|
||||
14
app/src/auth/auth-entities.ts
Normal file
14
app/src/auth/auth-entities.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { text } from "data/prototype";
|
||||
|
||||
export const usersFields = {
|
||||
email: text().required(),
|
||||
strategy: text({
|
||||
fillable: ["create"],
|
||||
hidden: ["update", "form"],
|
||||
}).required(),
|
||||
strategy_value: text({
|
||||
fillable: ["create"],
|
||||
hidden: ["read", "table", "update", "form"],
|
||||
}).required(),
|
||||
role: text(),
|
||||
};
|
||||
Reference in New Issue
Block a user