set new limit = 1500

This commit is contained in:
Hongbo Wu
2023-08-10 09:43:40 +08:00
parent 3df0ffc5d3
commit 51e0dfde23

View File

@ -40,16 +40,17 @@ const optInUltraRealisticVoice = async (uid: string): Promise<Feature> => {
return feature
}
// opt in to feature for the first 1000 users
const MAX_USERS = 1500
// opt in to feature for the first 1500 users
const newFeatures = (await AppDataSource.query(
`insert into omnivore.features (user_id, name, granted_at)
select $1, $2, $3 from omnivore.features
where name = $2 and granted_at is not null
having count(*) < 1000
having count(*) < $4
on conflict (user_id, name)
do update set granted_at = $3
returning *, granted_at as "grantedAt", created_at as "createdAt", updated_at as "updatedAt";`,
[uid, FeatureName.UltraRealisticVoice, new Date()]
[uid, FeatureName.UltraRealisticVoice, new Date(), MAX_USERS]
)) as Feature[]
// if no new features were created then user has exceeded max users