mirror of
https://github.com/ArthurDanjou/artdanj-shortener.git
synced 2026-01-26 23:54:16 +01:00
Reset Visit count while updating
This commit is contained in:
@@ -49,9 +49,12 @@ export default class LinksController {
|
||||
|
||||
public async updateLink ({request, auth}: HttpContextContract) {
|
||||
await auth.authenticate()
|
||||
const link = await Link.findByOrFail('code', request.input('link'))
|
||||
const link = await Link.findByOrFail('code', request.input('code'))
|
||||
const data = await request.validate(UpdateValidator)
|
||||
await link.merge(data).save()
|
||||
await link.merge({
|
||||
target: data.target,
|
||||
visitCount: 0
|
||||
}).save()
|
||||
return link
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user