Refactor metamigo-common
This commit is contained in:
parent
cae0071851
commit
b3d8c3918e
32 changed files with 5 additions and 14 deletions
|
|
@ -42,7 +42,6 @@ export abstract class AbstractCrudController<
|
||||||
abstract recordType: PgRecordInfo<TUnsavedR, TSavedR, IdKeyT>;
|
abstract recordType: PgRecordInfo<TUnsavedR, TSavedR, IdKeyT>;
|
||||||
|
|
||||||
repo(request: Hapi.Request): CrudRepository<TUnsavedR, TSavedR, IdKeyT> {
|
repo(request: Hapi.Request): CrudRepository<TUnsavedR, TSavedR, IdKeyT> {
|
||||||
// @ts-expect-error
|
|
||||||
const db = request[this.dbDecoration];
|
const db = request[this.dbDecoration];
|
||||||
if (!db)
|
if (!db)
|
||||||
throw Boom.badImplementation(
|
throw Boom.badImplementation(
|
||||||
|
|
@ -128,7 +127,6 @@ export abstract class AbstractCrudController<
|
||||||
): Promise<any> => {
|
): Promise<any> => {
|
||||||
try {
|
try {
|
||||||
const id: IdKeyT = request.params[this.paramsIdField];
|
const id: IdKeyT = request.params[this.paramsIdField];
|
||||||
// @ts-expect-error
|
|
||||||
const row: TSavedR = await this.repo(request).findById(id);
|
const row: TSavedR = await this.repo(request).findById(id);
|
||||||
|
|
||||||
if (!row) {
|
if (!row) {
|
||||||
|
|
@ -75,7 +75,6 @@ export class NextAuthAdapter<TRepositories extends IMetamigoRepositories>
|
||||||
return this.repos.users.update(user);
|
return this.repos.users.update(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ts-expect-error
|
|
||||||
async linkAccount(
|
async linkAccount(
|
||||||
userId: string,
|
userId: string,
|
||||||
providerId: string,
|
providerId: string,
|
||||||
|
|
@ -121,7 +120,6 @@ export class NextAuthAdapter<TRepositories extends IMetamigoRepositories>
|
||||||
}
|
}
|
||||||
|
|
||||||
const session: UnsavedSession = {
|
const session: UnsavedSession = {
|
||||||
// @ts-expect-error
|
|
||||||
expires,
|
expires,
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
sessionToken: randomToken(),
|
sessionToken: randomToken(),
|
||||||
|
|
@ -28,14 +28,10 @@ export const deepFreeze = (o: unknown): any => {
|
||||||
(oIsFunction
|
(oIsFunction
|
||||||
? prop !== "caller" && prop !== "callee" && prop !== "arguments"
|
? prop !== "caller" && prop !== "callee" && prop !== "arguments"
|
||||||
: true) &&
|
: true) &&
|
||||||
// @ts-expect-error
|
|
||||||
o[prop] !== null &&
|
o[prop] !== null &&
|
||||||
// @ts-expect-error
|
|
||||||
(typeof o[prop] === "object" || typeof o[prop] === "function") &&
|
(typeof o[prop] === "object" || typeof o[prop] === "function") &&
|
||||||
// @ts-expect-error
|
|
||||||
!Object.isFrozen(o[prop])
|
!Object.isFrozen(o[prop])
|
||||||
) {
|
) {
|
||||||
// @ts-expect-error
|
|
||||||
deepFreeze(o[prop]);
|
deepFreeze(o[prop]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -1,13 +1,12 @@
|
||||||
{
|
{
|
||||||
"extends": "../tsconfig.json",
|
"extends": "tsconfig-link",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"incremental": true,
|
"incremental": true,
|
||||||
"outDir": "build/main",
|
"outDir": "build/main",
|
||||||
"paths": {
|
"rootDir": "src",
|
||||||
"@hapipal/schmervice": ["vendor/hapipal__schmervice"],
|
"baseUrl": "./",
|
||||||
"*": ["node_modules/@types/*", "*"]
|
"types": ["jest", "node"]
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"include": ["**/*.ts"],
|
"include": ["src/**/*.ts"],
|
||||||
"exclude": ["node_modules/**"]
|
"exclude": ["node_modules/**"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue