mindspace: close authority boundaries
This commit is contained in:
@@ -1127,6 +1127,31 @@ export function createAssetService(pool, options = {}) {
|
||||
};
|
||||
};
|
||||
|
||||
const readAssetContent = async (
|
||||
userId,
|
||||
assetId,
|
||||
) => {
|
||||
const { asset, path: assetPath } =
|
||||
await readAsset(userId, assetId);
|
||||
const body = await fs.readFile(assetPath);
|
||||
return {
|
||||
asset,
|
||||
bodyBase64: body.toString('base64'),
|
||||
};
|
||||
};
|
||||
|
||||
const readPublicAssetContent = async (
|
||||
assetId,
|
||||
) => {
|
||||
const { asset, path: assetPath } =
|
||||
await readPublicAsset(assetId);
|
||||
const body = await fs.readFile(assetPath);
|
||||
return {
|
||||
asset,
|
||||
bodyBase64: body.toString('base64'),
|
||||
};
|
||||
};
|
||||
|
||||
const createChatAsset = async (
|
||||
userId,
|
||||
{ categoryCode, buffer, filename, displayName, sourceType = 'chat' },
|
||||
@@ -1464,6 +1489,8 @@ export function createAssetService(pool, options = {}) {
|
||||
deleteAsset,
|
||||
readAsset,
|
||||
readPublicAsset,
|
||||
readAssetContent,
|
||||
readPublicAssetContent,
|
||||
renderAssetPreview,
|
||||
extractAssetText,
|
||||
renderAssetThumbnail,
|
||||
|
||||
Reference in New Issue
Block a user