|
10 | 10 | use Utopia\Database\Exception\Duplicate; |
11 | 11 | use Utopia\Database\Exception\Structure; |
12 | 12 | use Utopia\Database\Query; |
13 | | -use Utopia\Database\Validator\Authorization; |
14 | 13 | use Utopia\Exception; |
15 | 14 |
|
16 | 15 | class Database extends TimeLimit |
@@ -139,7 +138,7 @@ protected function count(string $key, int $timestamp): int |
139 | 138 | $timestamp = $this->toDateTime($timestamp); |
140 | 139 |
|
141 | 140 | /** @var array<Document> $result */ |
142 | | - $result = Authorization::skip(function () use ($key, $timestamp) { |
| 141 | + $result = $this->db->getAuthorization()->skip(function () use ($key, $timestamp) { |
143 | 142 | return $this->db->find(self::COLLECTION, [ |
144 | 143 | Query::equal('key', [$key]), |
145 | 144 | Query::equal('time', [$timestamp]), |
@@ -172,7 +171,7 @@ protected function hit(string $key, int $timestamp): void |
172 | 171 | } |
173 | 172 |
|
174 | 173 | $timestamp = $this->toDateTime($timestamp); |
175 | | - Authorization::skip(function () use ($timestamp, $key) { |
| 174 | + $this->db->getAuthorization()->skip(function () use ($timestamp, $key) { |
176 | 175 | $data = $this->db->findOne(self::COLLECTION, [ |
177 | 176 | Query::equal('key', [$key]), |
178 | 177 | Query::equal('time', [$timestamp]), |
@@ -226,7 +225,7 @@ protected function hit(string $key, int $timestamp): void |
226 | 225 | protected function set(string $key, int $timestamp, int $value): void |
227 | 226 | { |
228 | 227 | $timestamp = $this->toDateTime($timestamp); |
229 | | - Authorization::skip(function () use ($timestamp, $key, $value) { |
| 228 | + $this->db->getAuthorization()->skip(function () use ($timestamp, $key, $value) { |
230 | 229 | $data = $this->db->findOne(self::COLLECTION, [ |
231 | 230 | Query::equal('key', [$key]), |
232 | 231 | Query::equal('time', [$timestamp]), |
@@ -284,7 +283,7 @@ protected function set(string $key, int $timestamp, int $value): void |
284 | 283 | public function getLogs(?int $offset = null, ?int $limit = 25): array |
285 | 284 | { |
286 | 285 | /** @var array<Document> $results */ |
287 | | - $results = Authorization::skip(function () use ($offset, $limit) { |
| 286 | + $results = $this->db->getAuthorization()->skip(function () use ($offset, $limit) { |
288 | 287 | $queries = []; |
289 | 288 | $queries[] = Query::orderDesc(''); |
290 | 289 |
|
@@ -312,7 +311,7 @@ public function getLogs(?int $offset = null, ?int $limit = 25): array |
312 | 311 | public function cleanup(int $timestamp): bool |
313 | 312 | { |
314 | 313 | $timestamp = $this->toDateTime($timestamp); |
315 | | - Authorization::skip(function () use ($timestamp) { |
| 314 | + $this->db->getAuthorization()->skip(function () use ($timestamp) { |
316 | 315 | do { |
317 | 316 | $documents = $this->db->find(self::COLLECTION, [ |
318 | 317 | Query::lessThan('time', $timestamp), |
|
0 commit comments