fix(auth): finding previous subscription setting for irreplacable subscription settings

This commit is contained in:
Karol Sójko
2022-09-29 14:18:16 +02:00
parent 1ce2b9eb44
commit 0a5b7e13cd
14 changed files with 129 additions and 10 deletions
@@ -14,6 +14,16 @@ export class MySQLUserSubscriptionRepository implements UserSubscriptionReposito
private ormRepository: Repository<UserSubscription>,
) {}
async findByUserUuid(userUuid: string): Promise<UserSubscription[]> {
return await this.ormRepository
.createQueryBuilder()
.where('user_uuid = :user_uuid', {
user_uuid: userUuid,
})
.orderBy('ends_at', 'DESC')
.getMany()
}
async countByUserUuid(userUuid: Uuid): Promise<number> {
return await this.ormRepository
.createQueryBuilder()