mirror of
https://github.com/standardnotes/server
synced 2026-10-21 15:03:42 -04:00
fix(auth): add persisting statistics for all subscription plans
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { MapperInterface, Uuid } from '@standardnotes/domain-core'
|
||||
import { MapperInterface, SubscriptionPlanName, Uuid } from '@standardnotes/domain-core'
|
||||
import { Repository } from 'typeorm'
|
||||
import { SessionTrace } from '../../Domain/Session/SessionTrace'
|
||||
import { SessionTraceRepositoryInterface } from '../../Domain/Session/SessionTraceRepositoryInterface'
|
||||
@@ -10,6 +10,18 @@ export class MySQLSessionTraceRepository implements SessionTraceRepositoryInterf
|
||||
private mapper: MapperInterface<SessionTrace, TypeORMSessionTrace>,
|
||||
) {}
|
||||
|
||||
async countByDateAndSubscriptionPlanName(date: Date, subscriptionPlanName: SubscriptionPlanName): Promise<number> {
|
||||
return this.ormRepository
|
||||
.createQueryBuilder('trace')
|
||||
.where('trace.creation_date = :creationDate', {
|
||||
creationDate: new Date(date.getFullYear(), date.getMonth(), date.getDate()),
|
||||
})
|
||||
.andWhere('trace.subscription_plan_name = :subscriptionPlanName', {
|
||||
subscriptionPlanName: subscriptionPlanName.value,
|
||||
})
|
||||
.getCount()
|
||||
}
|
||||
|
||||
async countByDate(date: Date): Promise<number> {
|
||||
return this.ormRepository
|
||||
.createQueryBuilder('trace')
|
||||
|
||||
Reference in New Issue
Block a user