Skip to content

Conversation

@jona159
Copy link
Contributor

@jona159 jona159 commented Sep 10, 2025

No description provided.

scheidtdav and others added 30 commits May 14, 2025 16:26
* feat(api): add api routes for /users/me

* fix(tests): api me PUT

* feat(api): add delete me endpoint
@jona159 jona159 marked this pull request as ready for review October 22, 2025 08:37
This was linked to issues Oct 22, 2025
Comment on lines +24 to +45
export const createTransfer = async (
boxId: string,
expiresAt?: Date
): Promise<Claim> => {
const token = generateTransferCode();
const expirationDate = expiresAt || getDefaultExpirationDate();

const [newClaim] = await drizzleClient
.insert(claim)
.values({
boxId,
token,
expiresAt: expirationDate,
})
.returning();

if (!newClaim) {
throw new Error("Failed to create transfer claim");
}

return newClaim;
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be redundant, as there is createBoxTransfer in transfer-service.server.ts.
Same for the other methods in this file. Why do both versions need to exist? 🤔

if (!contentType || !contentType.includes("application/json")) {
return Response.json(
{
code: "NotAuthorized",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NotAuthorized 🤨 Isn't this Unsupported Media Type?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is 😅 should be fixed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually i just remembered, i found this example in the opensensemap docs:

HTTP/1.1 415 Unsupported Media Type
{"code":"NotAuthorized","message":"Unsupported content-type. Try application/json"}

which is why i first wrote NotAuthorized, but now that i think about it again we should just fix the code here right? I dont think any would check against the Code being NotAuthorized?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I can see in restify-errors implementation (which is what the old api is using), I think this might even be wrong in the docs 😅
So yes, definitely it should be UnsupportedMediaType.

In fact, when you try it the osem api actually returns that:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

migrate /boxes/transfer migrate /boxes/claim

3 participants