feat(storage): group archives by the BPM order field
This commit is contained in:
1 parent
607b240aa3
commit
fff2a29ec0
13 files changed
+163
-18
No files matched your search
@@ -15,11 +15,11 @@ test('storage HTTP enforces roles, redacts passwords and archives only successfu
|
||||
assert.equal((await call(`/api/storage/servers/${server.id}/files`,undefined,viewer)).status,403);
|
||||
assert.equal((await call(`/api/storage/servers/${server.id}/check`,{},admin)).status,200);
|
||||
const overview=await(await call('/api/overview',undefined,admin)).json();assert.equal(overview.connections.find(c=>c.name==='存储服务器').ready,true);
|
||||
await fs.writeFile(path.join(outputDir,'order.pdf'),'%PDF-1.7\nHTTP document');store.recordJob({jobId:'job-1',status:'success',path:path.join(outputDir,'order.pdf'),filename:'order.pdf'});
|
||||
await fs.writeFile(path.join(outputDir,'order.pdf'),'%PDF-1.7\nHTTP document');store.recordJob({jobId:'job-1',status:'success',path:path.join(outputDir,'order.pdf'),filename:'order.pdf',metadata:{order:'001234'}});
|
||||
assert.equal((await call(`/api/storage/servers/${server.id}/archive`,{jobId:'job-1',directory:'产业A'},viewer)).status,403);
|
||||
const archived=await call(`/api/storage/servers/${server.id}/archive`,{jobId:'job-1',directory:'产业A'},operator);assert.equal(archived.status,200);assert.equal((await archived.json()).status,'success');
|
||||
assert.equal(storageStore.archives().length,1);
|
||||
const downloaded=await call(`/api/storage/servers/${server.id}/file?path=${encodeURIComponent('产业A/order.pdf')}`,undefined,operator);assert.equal(downloaded.status,200);assert.equal(await downloaded.text(),'%PDF-1.7\nHTTP document');
|
||||
const downloaded=await call(`/api/storage/servers/${server.id}/file?path=${encodeURIComponent('产业A/001234/order.pdf')}`,undefined,operator);assert.equal(downloaded.status,200);assert.equal(await downloaded.text(),'%PDF-1.7\nHTTP document');
|
||||
store.recordJob({jobId:'outside',status:'success',path:path.join(dir,'outside.pdf'),filename:'outside.pdf'});await fs.writeFile(path.join(dir,'outside.pdf'),'%PDF-1.7\noutside');
|
||||
assert.equal((await call(`/api/storage/servers/${server.id}/archive`,{jobId:'outside',directory:''},admin)).status,400);
|
||||
});
|
||||
@@ -30,8 +30,8 @@ test('automatic storage is opt-in, starts with new jobs and never queues mail',a
|
||||
await storage.automatic(old);assert.deepEqual(await fs.readdir(remote),[]);
|
||||
await assert.rejects(Promise.resolve().then(()=>storage.saveSettings({serverId:server.id,enabled:true})),e=>e.status===409);
|
||||
await storage.check(server.id);storage.saveSettings({serverId:server.id,enabled:true});await storage.automatic(old);assert.deepEqual(await fs.readdir(remote),[]);
|
||||
const job=store.recordJob({jobId:'new-job',status:'success',path:path.join(outputDir,'new.pdf'),filename:'new.pdf',createdAt:new Date(Date.now()+1).toISOString()});await storage.automatic(job);
|
||||
assert.deepEqual(await fs.readdir(remote),['new.pdf']);assert.equal(storageStore.archives()[0].status,'success');
|
||||
const job=store.recordJob({jobId:'new-job',status:'success',path:path.join(outputDir,'new.pdf'),filename:'new.pdf',metadata:{order:'7654321'},createdAt:new Date(Date.now()+1).toISOString()});await storage.automatic(job);
|
||||
assert.deepEqual(await fs.readdir(remote),['7654321']);assert.deepEqual(await fs.readdir(path.join(remote,'7654321')),['new.pdf']);assert.equal(storageStore.archives()[0].status,'success');
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user