KingMaLiTHa
KingMaLiTHa
Explore posts from servers
TTCTheo's Typesafe Cult
Created by KingMaLiTHa on 1/12/2025 in #questions
How to handle Monthly quota on Semi Annual and Annual Plans (Stripe/ Payment related)
Hey, I am building an saas application, for subscription we will give monthly quota for the user. How to handle this monthly quota for the annual and semi annual users. Is there is way to handle this easy? Or we have to use some cron or event triggering service to do this. Thanks
1 replies
PPrisma
Created by KingMaLiTHa on 12/17/2024 in #help-and-questions
Type Issues with Client Extension in Nest JS
Hello, I am trying client extension with my nestjs application. But I am facing some type issues, can you help me. here is my code.
import { Logger } from '@nestjs/common';
import { Prisma } from '@prisma/client';

export type ExtendedPrismaClient = ReturnType<
typeof createExtendedPrismaClient
>;

export function createExtendedPrismaClient(logger: Logger) {
return Prisma.defineExtension({
query: {
async $allOperations({ operation, model, args, query }) {
// GET PERFORMANCE
return result;
},
},
});
}
import { Logger } from '@nestjs/common';
import { Prisma } from '@prisma/client';

export type ExtendedPrismaClient = ReturnType<
typeof createExtendedPrismaClient
>;

export function createExtendedPrismaClient(logger: Logger) {
return Prisma.defineExtension({
query: {
async $allOperations({ operation, model, args, query }) {
// GET PERFORMANCE
return result;
},
},
});
}
here is my PrismaService:
@Injectable()
export class PrismaService
extends PrismaClient
implements OnModuleInit, OnModuleDestroy
{
public readonly extendedClient: ExtendedPrismaClient;

private readonly logger = new Logger(PrismaService.name);
constructor() {
super();
this.extendedClient = this.$extends(
createExtendedPrismaClient(this.logger),
);
}
async onModuleInit() {
await this.$connect();
}

async onModuleDestroy() {
await this.$disconnect();
}
}
@Injectable()
export class PrismaService
extends PrismaClient
implements OnModuleInit, OnModuleDestroy
{
public readonly extendedClient: ExtendedPrismaClient;

private readonly logger = new Logger(PrismaService.name);
constructor() {
super();
this.extendedClient = this.$extends(
createExtendedPrismaClient(this.logger),
);
}
async onModuleInit() {
await this.$connect();
}

async onModuleDestroy() {
await this.$disconnect();
}
}
I am getting this error from this.extendedclient.
Type 'DynamicClientExtensionThis<TypeMap<InternalArgs & { result: {}; model: {}; query: {}; client: {}; }, PrismaClientOptions>, TypeMapCb, { result: {}; model: {}; query: {}; client: {}; }, {}>' is not assignable to type '(client: any) => { $extends: { extArgs: InternalArgs<unknown, unknown, {}, unknown>; }; }'.
Type 'DynamicClientExtensionThis<TypeMap<InternalArgs & { result: {}; model: {}; query: {}; client: {}; }, PrismaClientOptions>, TypeMapCb, { result: {}; model: {}; query: {}; client: {}; }, {}>' provides no match for the signature '(client: any): { $extends: { extArgs: InternalArgs<unknown, unknown, {}, unknown>; }; }'.
Type 'DynamicClientExtensionThis<TypeMap<InternalArgs & { result: {}; model: {}; query: {}; client: {}; }, PrismaClientOptions>, TypeMapCb, { result: {}; model: {}; query: {}; client: {}; }, {}>' is not assignable to type '(client: any) => { $extends: { extArgs: InternalArgs<unknown, unknown, {}, unknown>; }; }'.
Type 'DynamicClientExtensionThis<TypeMap<InternalArgs & { result: {}; model: {}; query: {}; client: {}; }, PrismaClientOptions>, TypeMapCb, { result: {}; model: {}; query: {}; client: {}; }, {}>' provides no match for the signature '(client: any): { $extends: { extArgs: InternalArgs<unknown, unknown, {}, unknown>; }; }'.
4 replies
KPCKevin Powell - Community
Created by KingMaLiTHa on 6/29/2023 in #front-end
Help in fluid cursor Animation
Hello, In this github repo, there is fluid cursor animation. But the problem is it works when user clicked or click and drag. I want to create it follow the cursor even without clicking. Can you help me ? Here is the github repo: https://github.com/malik-tillman/Fluid-JS
1 replies