feat: decouple views from projects #2217

Merged
konrad merged 97 commits from feature/decouple-views-from-projects into main 2024-03-19 19:16:14 +00:00
3 changed files with 14 additions and 6 deletions
Showing only changes of commit 445f1c06fa - Show all commits

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)
}