mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-22 21:06:37 +00:00
Update member resources page and testing new org counts
This commit is contained in:
@@ -130,18 +130,22 @@ export class UsageService {
|
||||
featureId,
|
||||
orgId,
|
||||
meterId,
|
||||
instantaneousValue: value,
|
||||
latestValue: value,
|
||||
instantaneousValue: value || 0,
|
||||
latestValue: value || 0,
|
||||
updatedAt: Math.floor(Date.now() / 1000)
|
||||
})
|
||||
.onConflictDoUpdate({
|
||||
target: usage.usageId,
|
||||
set: {
|
||||
instantaneousValue: sql`${usage.instantaneousValue} + ${value}`
|
||||
instantaneousValue: sql`COALESCE(${usage.instantaneousValue}, 0) + ${value}`
|
||||
}
|
||||
})
|
||||
.returning();
|
||||
|
||||
logger.debug(
|
||||
`Added usage for org ${orgId} feature ${featureId}: +${value}, new instantaneousValue: ${returnUsage.instantaneousValue}`
|
||||
);
|
||||
|
||||
return returnUsage;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user