Commit 56f27212 authored by nanahira's avatar nanahira

fix prototype things

parent 27bd8648
......@@ -34,10 +34,13 @@ export class Aragami {
return 'default';
}
private async getKey(o: any) {
private async getKey(o: any, prototype?: AnyClass) {
if (typeof o === 'string') {
return o;
}
if (prototype) {
o = plainToInstance(prototype, o);
}
const keyTransformer = reflector.get('AragamiCacheKey', o);
if (!keyTransformer) {
throw new Error(`No key metadata found for ${o.constructor.name}`);
......@@ -125,7 +128,7 @@ export class Aragami {
) {
return async (...args: A): Promise<T> => {
const keyMeta = await keySource(...args);
const key = await this.getKey(keyMeta);
const key = await this.getKey(keyMeta, cl);
if (!key) {
return cb(...args);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment