Skip to content

Commit 3b40ce1

Browse files
committed
fixed all issues
1 parent e7bf99a commit 3b40ce1

12 files changed

Lines changed: 16 additions & 18 deletions

File tree

bin/rerum_v1.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ import config from '../config/index.js'
1616

1717
const port = config.PORT ?? 3001
1818
app.set('port', port)
19-
20-
21-
2219
/**
2320
* Create HTTP server.
2421
*/

controllers/bulk.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,17 +131,17 @@ const bulkUpdate = async function (req, res, next) {
131131
return next(createExpressError(err))
132132
}
133133

134-
134+
let encountered = []
135135
const gatekeep = documents.filter(d => {
136-
if (!isValidJsonObject(d)) return true
136+
if (!isValidJsonObject(d)) return true
137137
const idcheck = _contextid(d["@context"]) ? (d.id ?? d["@id"]) : d["@id"]
138-
if (idcheck) return true
138+
if (!idcheck) return true // Reject items WITHOUT an id (updates need an id)
139139
return false
140140
})
141141
// The empty {}s will cause this error
142142
if (gatekeep.length > 0) {
143143
return next(createExpressError({
144-
message: "All objects in the body of a `/bulkCreate` must be JSON and must not contain a declared identifier property.",
144+
message: "All objects in the body of a `/bulkUpdate` must be JSON and must contain a declared identifier property.",
145145
status: 400
146146
}))
147147
}

package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

routes/__tests__/bulkCreate.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ it("'/bulkCreate' route functions", async () => {
3333
expect(response.headers["date"]).toBeTruthy()
3434
expect(response.headers["etag"]).toBeTruthy()
3535
expect(response.headers["link"]).toBeTruthy()
36-
}, 20000)
36+
})

routes/__tests__/delete.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ it("'/delete' route functions", async () => {
3737
.then(resp => resp)
3838
.catch(err => err)
3939
expect(response.statusCode).toBe(204)
40-
}, 20000)
40+
})

routes/__tests__/history.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ it("'/history/:id' route functions", async () => {
2727
expect(response.headers["allow"]).toBeTruthy()
2828
expect(response.headers["link"]).toBeTruthy()
2929
expect(Array.isArray(response.body)).toBe(true)
30-
}, 20000)
30+
})

routes/__tests__/patch.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ it("'/patch' route functions", async () => {
3737
expect(response.headers["allow"]).toBeTruthy()
3838
expect(response.headers["link"]).toBeTruthy()
3939

40-
}, 20000)
40+
})

routes/__tests__/set.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ it("'/set' route functions", async () => {
3939
expect(response.headers["etag"]).toBeTruthy()
4040
expect(response.headers["allow"]).toBeTruthy()
4141
expect(response.headers["link"]).toBeTruthy()
42-
}, 20000)
42+
})

routes/__tests__/since.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ it("'/since/:id' route functions", async () => {
2626
expect(response.headers["allow"]).toBeTruthy()
2727
expect(response.headers["link"]).toBeTruthy()
2828
expect(Array.isArray(response.body)).toBe(true)
29-
}, 20000)
29+
})

routes/__tests__/unset.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@ it("'/unset' route functions", async () => {
3737
expect(response.headers["etag"]).toBeTruthy()
3838
expect(response.headers["allow"]).toBeTruthy()
3939
expect(response.headers["link"]).toBeTruthy()
40-
}, 20000)
40+
})
4141

0 commit comments

Comments
 (0)