Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit feb8aa7

Browse files
#638 - filter uploads by org
1 parent 13586c2 commit feb8aa7

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/services/UploadService.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,17 @@ async function getEntities (query) {
4141
if (!query.from) {
4242
query.from = (new Date((new Date()).setDate((new Date()).getDate() - 1)).toISOString()) // 24 hours ago
4343
}
44-
const uploads = await helper.getAll(config.AMAZON.DYNAMODB_UPLOAD_TABLE, { created: { ge: query.from } })
44+
const uploads = await helper.getAll(
45+
config.AMAZON.DYNAMODB_UPLOAD_TABLE,
46+
{
47+
created: {
48+
ge: query.from
49+
},
50+
organizationId: {
51+
eq: query.organizationId
52+
}
53+
}
54+
)
4555
const res = _.map(uploads, (upload) => {
4656
upload = _.extend(
4757
_.omit(
@@ -59,9 +69,10 @@ async function getEntities (query) {
5969
return res
6070
}
6171

62-
getEntity.schema = {
72+
getEntities.schema = {
6373
query: Joi.object().keys({
64-
from: Joi.date().iso()
74+
from: Joi.string(),
75+
organizationId: Joi.string().required()
6576
})
6677
}
6778

0 commit comments

Comments
 (0)