fix(views): make bucket creation work again

This commit is contained in:
kolaente 2024-03-16 15:08:29 +01:00
parent 4c1a53beed
commit 445f1c06fa
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
3 changed files with 14 additions and 6 deletions

View File

@ -6,10 +6,10 @@ import type { IBucket } from '@/modelTypes/IBucket'
export default class BucketService extends AbstractService<IBucket> {
constructor() {
super({
getAll: '/projects/{projectId}/buckets',
create: '/projects/{projectId}/buckets',
update: '/projects/{projectId}/buckets/{id}',
delete: '/projects/{projectId}/buckets/{id}',
getAll: '/projects/{projectId}/views/{projectViewId}/buckets',
create: '/projects/{projectId}/views/{projectViewId}/buckets',
update: '/projects/{projectId}/views/{projectViewId}/buckets/{id}',
delete: '/projects/{projectId}/views/{projectViewId}/buckets/{id}',
})
}

View File

@ -576,6 +576,7 @@ async function createNewBucket() {
await kanbanStore.createBucket(new BucketModel({
title: newBucketTitle.value,
projectId: project.value.id,
projectViewId: viewId,
}))
newBucketTitle.value = ''
}
@ -595,6 +596,7 @@ async function deleteBucket() {
bucket: new BucketModel({
id: bucketToDelete.value,
projectId: project.value.id,
projectViewId: viewId,
}),
params: params.value,
})

View File

@ -23,7 +23,10 @@ import (
// CanCreate checks if a user can create a new bucket
func (b *Bucket) CanCreate(s *xorm.Session, a web.Auth) (bool, error) {
pv := &ProjectView{ID: b.ProjectViewID}
pv := &ProjectView{
ID: b.ProjectViewID,
ProjectID: b.ProjectID,
}
return pv.CanUpdate(s, a)
}
@ -43,6 +46,9 @@ func (b *Bucket) canDoBucket(s *xorm.Session, a web.Auth) (bool, error) {
if err != nil {
return false, err
}
pv := &ProjectView{ID: bb.ProjectViewID}
pv := &ProjectView{
ID: bb.ProjectViewID,
ProjectID: bb.ProjectID,
}
return pv.CanUpdate(s, a)
}