@axium/storage 0.18.4 → 0.18.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/db.json +7 -2
- package/dist/server/api.js +9 -3
- package/dist/server/db.d.ts +1 -0
- package/package.json +1 -1
package/db.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "../server/schemas/db.json",
|
|
3
|
-
"format":
|
|
3
|
+
"format": 1,
|
|
4
4
|
"versions": [
|
|
5
5
|
{
|
|
6
6
|
"delta": false,
|
|
@@ -34,7 +34,12 @@
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
|
-
"indexes":
|
|
37
|
+
"indexes": {
|
|
38
|
+
"storage_userId": { "on": "storage", "columns": ["userId"] },
|
|
39
|
+
"storage_parentId": { "on": "storage", "columns": ["parentId"] },
|
|
40
|
+
"acl_storage_userId": { "on": "acl.storage", "columns": ["userId"] },
|
|
41
|
+
"acl_storage_itemId": { "on": "acl.storage", "columns": ["itemId"] }
|
|
42
|
+
}
|
|
38
43
|
},
|
|
39
44
|
{
|
|
40
45
|
"delta": true,
|
package/dist/server/api.js
CHANGED
|
@@ -125,7 +125,13 @@ addRoute({
|
|
|
125
125
|
error(503, 'User storage is disabled');
|
|
126
126
|
await checkAuthForUser(request, userId);
|
|
127
127
|
const [items, stats, limits] = await Promise.all([
|
|
128
|
-
database
|
|
128
|
+
database
|
|
129
|
+
.selectFrom('storage')
|
|
130
|
+
.selectAll()
|
|
131
|
+
.select(acl.from('storage'))
|
|
132
|
+
.where('userId', '=', userId)
|
|
133
|
+
.where('trashedAt', 'is', null)
|
|
134
|
+
.execute(),
|
|
129
135
|
getUserStats(userId),
|
|
130
136
|
getLimits(userId),
|
|
131
137
|
]).catch(withError('Could not fetch data'));
|
|
@@ -141,11 +147,11 @@ addRoute({
|
|
|
141
147
|
await checkAuthForUser(request, userId);
|
|
142
148
|
const items = await database
|
|
143
149
|
.selectFrom('storage')
|
|
150
|
+
.selectAll()
|
|
144
151
|
.select(acl.from('storage'))
|
|
145
152
|
.where('userId', '=', userId)
|
|
146
153
|
.where('trashedAt', 'is', null)
|
|
147
154
|
.where('parentId', 'is', null)
|
|
148
|
-
.selectAll()
|
|
149
155
|
.execute()
|
|
150
156
|
.catch(withError('Could not get storage items'));
|
|
151
157
|
return items.map(parseItem);
|
|
@@ -179,9 +185,9 @@ addRoute({
|
|
|
179
185
|
await checkAuthForUser(request, userId);
|
|
180
186
|
const items = await database
|
|
181
187
|
.selectFrom('storage')
|
|
188
|
+
.selectAll()
|
|
182
189
|
.where('userId', '=', userId)
|
|
183
190
|
.where('trashedAt', 'is not', null)
|
|
184
|
-
.selectAll()
|
|
185
191
|
.execute()
|
|
186
192
|
.catch(withError('Could not get trash'));
|
|
187
193
|
return items.map(parseItem);
|
package/dist/server/db.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type Schema } from '@axium/server/database';
|
|
2
|
+
import type { FromFile as FromSchemaFile } from '@axium/server/db/schema';
|
|
2
3
|
import type { Selectable } from 'kysely';
|
|
3
4
|
import type schema from '../../db.json';
|
|
4
5
|
import type { StorageItemMetadata, StorageStats } from '../common.js';
|