Task Relations #103

Merged
konrad merged 33 commits from feature/task-relations into master 2019-09-25 18:44:42 +00:00
3 changed files with 58 additions and 0 deletions
Showing only changes of commit 85e37bd89e - Show all commits

View File

@ -49,6 +49,7 @@ func GetTables() []interface{} {
&LabelTask{},
&TaskReminder{},
&LinkSharing{},
&TaskRelation{},
}
}

View File

@ -46,6 +46,13 @@ type TaskRelation struct {
// The kind of the relation.
RelationKind RelationKind `xorm:"int(11) not null" json:"relation_kind"`
CreatedByID int64 `xorm:"int(11) not null" json:"-"`
// The user who created this relation
CreatedBy *User `xorm:"-" json:"created_by"`
// A unix timestamp when this label was created. You cannot change this value.
Created int64 `xorm:"created not null" json:"created"`
web.CRUDable `xorm:"-" json:"-"`
web.Rights `xorm:"-" json:"-"`
}

View File

@ -0,0 +1,50 @@
// Copyright 2019 Vikunja and contriubtors. All rights reserved.
//
// This file is part of Vikunja.
//
// Vikunja is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Vikunja is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Vikunja. If not, see <https://www.gnu.org/licenses/>.
package models
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestTaskRelation_Create(t *testing.T) {
t.Run("Normal", func(t *testing.T) {
})
t.Run("Two Tasks In Different Lists", func(t *testing.T) {
rel := TaskRelation{
TaskID: 1,
OtherTaskID: 13,
RelationKind: RelationKindSubtask,
}
err := rel.Create(&User{ID: 1})
assert.NoError(t, err)
})
t.Run("Already Existing", func(t *testing.T) {
})
}
func TestTaskRelation_Delete(t *testing.T) {
t.Run("Normal", func(t *testing.T) {
})
t.Run("Not existing", func(t *testing.T) {
})
}