fixed tatort api route for deletion
Some checks failed
InnoHub Processor/tatort/pipeline/pr-development There was a failure building this commit
Some checks failed
InnoHub Processor/tatort/pipeline/pr-development There was a failure building this commit
This commit is contained in:
35
src/routes/api/list/[vorgang]/[tatort]/+server.ts
Normal file
35
src/routes/api/list/[vorgang]/[tatort]/+server.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { BUCKET, client } from '$lib/minio';
|
||||
|
||||
export async function GET() {
|
||||
const stream = client.listObjectsV2(BUCKET, '', true);
|
||||
const result = new ReadableStream({
|
||||
start(controller) {
|
||||
stream.on('data', (data) => {
|
||||
controller.enqueue(`${JSON.stringify(data)}\n`);
|
||||
});
|
||||
stream.on('end', () => {
|
||||
controller.close();
|
||||
});
|
||||
},
|
||||
cancel() {
|
||||
stream.destroy();
|
||||
}
|
||||
});
|
||||
|
||||
return new Response(result, {
|
||||
headers: {
|
||||
'content-type': 'text/event-stream'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
export async function DELETE({ request }: { request: Request }) {
|
||||
const url_fragments = request.url.split('/');
|
||||
const item = url_fragments.at(-1);
|
||||
const vorgang = url_fragments.at(-2);
|
||||
|
||||
await client.removeObject(BUCKET, `${vorgang}/${item}`);
|
||||
|
||||
return new Response(null, { status: 204 });
|
||||
}
|
||||
Reference in New Issue
Block a user