mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 12:37:20 +00:00
introduced auth strategy actions to allow user creation in UI
This commit is contained in:
@@ -3,7 +3,15 @@ import type { Guard } from "auth";
|
||||
import { SchemaObject } from "core";
|
||||
import type { EventManager } from "core/events";
|
||||
import type { Static, TSchema } from "core/utils";
|
||||
import type { Connection, EntityIndex, EntityManager, em as prototypeEm } from "data";
|
||||
import {
|
||||
type Connection,
|
||||
type EntityIndex,
|
||||
type EntityManager,
|
||||
type Field,
|
||||
FieldPrototype,
|
||||
make,
|
||||
type em as prototypeEm
|
||||
} from "data";
|
||||
import { Entity } from "data";
|
||||
import type { Hono } from "hono";
|
||||
|
||||
@@ -184,4 +192,16 @@ export abstract class Module<Schema extends TSchema = TSchema, ConfigSchema = St
|
||||
|
||||
return schema;
|
||||
}
|
||||
|
||||
protected replaceEntityField(
|
||||
_entity: string | Entity,
|
||||
field: Field | string,
|
||||
_newField: Field | FieldPrototype
|
||||
) {
|
||||
const entity = this.ctx.em.entity(_entity);
|
||||
const name = typeof field === "string" ? field : field.name;
|
||||
const newField =
|
||||
_newField instanceof FieldPrototype ? make(name, _newField as any) : _newField;
|
||||
entity.__replaceField(name, newField);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user