Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update driver api #232

Merged
merged 6 commits into from
Feb 27, 2025
Merged

update driver api #232

merged 6 commits into from
Feb 27, 2025

Conversation

steffenheger
Copy link
Contributor

No description provided.

@steffenheger steffenheger self-assigned this Feb 27, 2025
Copy link
Member

@felixguendling felixguendling left a comment

Choose a reason for hiding this comment

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

error
Throws an error with a HTTP status code and an optional message. When called during request handling, this will cause SvelteKit to return an error response without invoking handleError. Make sure you’re not catching the thrown error, which would prevent SvelteKit from handling it.
https://svelte.dev/docs/kit/@sveltejs-kit#error


return json({ success: true });
if (result.numUpdatedRows === BigInt(0)) {
throw error(404, 'Not found');
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

??

Copy link
Member

Choose a reason for hiding this comment

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

error
Throws an error with a HTTP status code and an optional message. When called during request handling, this will cause SvelteKit to return an error response without invoking handleError. Make sure you’re not catching the thrown error, which would prevent SvelteKit from handling it.
https://svelte.dev/docs/kit/@sveltejs-kit#error


export const GET = async ({ locals, url }) => {
const companyId = locals.session!.companyId!;
const fromTime = readInt(url.searchParams.get('fromTime'));
const toTime = readInt(url.searchParams.get('toTime'));

if (isNaN(fromTime) || isNaN(toTime)) {
throw error(400, 'Bad request');
Copy link
Member

Choose a reason for hiding this comment

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

const requestId = readInt(url.searchParams.get('requestId'));
const ticketCode = url.searchParams.get('ticketCode');

if (typeof ticketCode !== 'string' || isNaN(requestId)) {
throw 'bad params';
throw error(400, 'Bad request');
Copy link
Member

Choose a reason for hiding this comment

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


return json({ success: true });
if (result.numUpdatedRows === BigInt(0)) {
throw error(404, 'Not found');
Copy link
Member

Choose a reason for hiding this comment

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

@felixguendling felixguendling merged commit f68447c into master Feb 27, 2025
2 checks passed
@felixguendling felixguendling deleted the driver-api-update branch February 27, 2025 13:42
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.

2 participants