mirror of
https://github.com/HeyPuter/puter.git
synced 2026-02-19 21:21:23 -06:00
fix: sqlite syntax inconsistency
The SQL statement for creating a group uses syntax that only works under sqlite. This was caused by introducing anomaly detection when a user creates a large number of groups in quick succession.
This commit is contained in:
@@ -105,8 +105,11 @@ class GroupService extends BaseService {
|
||||
|
||||
const [{ n_groups }] = await this.db.read(
|
||||
"SELECT COUNT(*) AS n_groups FROM `group` WHERE " +
|
||||
"owner_user_id=? AND " +
|
||||
"created_at >= datetime('now', '-1 hour')",
|
||||
"owner_user_id=? AND created_at >= " +
|
||||
this.db.case({
|
||||
sqlite: "datetime('now', '-1 hour')",
|
||||
otherwise: "NOW() - INTERVAL 1 HOUR"
|
||||
}),
|
||||
[owner_user_id]
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user