forked from s1lvax/route
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Links and Skills order modification via Drag and Drop
Added '/profile/links/order' and '/profile/skills/order' endpoints.
- Loading branch information
1 parent
32ba105
commit 297202b
Showing
11 changed files
with
121 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import type { RequestHandler } from './$types'; | ||
import { prisma } from '$lib/server/prisma'; | ||
import type { Link } from '@prisma/client/wasm'; | ||
|
||
export const PATCH: RequestHandler = async (event) => { | ||
const json = await event.request.json(); | ||
const links: Link[] = json.links; | ||
|
||
links.forEach(async (link, idx) => { | ||
await prisma.link.update({ | ||
where: { | ||
id: link.id | ||
}, | ||
data: { | ||
order: idx | ||
} | ||
}); | ||
}); | ||
|
||
return new Response(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import type { RequestHandler } from './$types'; | ||
import { prisma } from '$lib/server/prisma'; | ||
import type { Skill } from '@prisma/client/wasm'; | ||
|
||
export const PATCH: RequestHandler = async (event) => { | ||
const json = await event.request.json(); | ||
const skills: Skill[] = json.skills; | ||
|
||
skills.forEach(async (skill, idx) => { | ||
await prisma.skill.update({ | ||
where: { | ||
id: skill.id | ||
}, | ||
data: { | ||
order: idx | ||
} | ||
}); | ||
}); | ||
|
||
return new Response(); | ||
}; |