Skip to content

Commit

Permalink
Fix typecheck
Browse files Browse the repository at this point in the history
  • Loading branch information
markspolakovs committed Dec 26, 2023
1 parent eb63a55 commit 9c4ef5e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion scores-src/src/server/eventsRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { ensure } from "./errs";
import { BadRequest } from "http-errors";
import { doUpdate as updateTournamentSummary } from "./updateTournamentSummary.job";
import { getLogger } from "./loggingSetup";
import { CouchbaseCas } from "./dbHelpers";

export function createEventsRouter() {
const router = Router();
Expand Down Expand Up @@ -134,7 +135,7 @@ export function createEventsRouter() {
"league",
]).validate(inputData, { abortEarly: false, stripUnknown: true });
await DB.collection("_default").replace(metaKey(league, type, id), val, {
cas: cas,
cas: cas ? CouchbaseCas.from(cas) : undefined,
});
res.status(200).json(val);
})
Expand Down
2 changes: 1 addition & 1 deletion scores-src/src/server/userManagementRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export function createUserManagementRouter() {
};
const data = await DB.collection("_default").getAndLock(id, 10);
try {
if (payload._cas && data.cas != payload._cas) {
if (payload._cas && data.cas.toString() != payload._cas) {
throw new Conflict("someone else has updated this user");
}
newData.passwordHash = data.content.passwordHash;
Expand Down

0 comments on commit 9c4ef5e

Please sign in to comment.