diff options
author | Özgür Kesim <oec@codeblau.de> | 2023-12-27 14:51:01 +0100 |
---|---|---|
committer | Özgür Kesim <oec@codeblau.de> | 2023-12-27 14:51:01 +0100 |
commit | 9afc0ce0ff104e176400fc8e373ece30d1b16fde (patch) | |
tree | 2a8cc05dfe0c8c677dc59c73abd767be6a1eda2d /project.go | |
parent | 3fb0453a86f0f2f6f68d26b6fe38942c765dbbc7 (diff) |
added version details
Diffstat (limited to 'project.go')
-rw-r--r-- | project.go | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/project.go b/project.go new file mode 100644 index 0000000..aca73ba --- /dev/null +++ b/project.go @@ -0,0 +1,67 @@ +package main + +import "time" + +/* + This file is part of taler-dashboard + Copyright (C) 2023 Özgür Kesim + + taler-dashboard is free software; you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published by the + Free Software Foundation; either version 3, or (at your option) any later + version. + + taler-dashboard 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 Affero General Public + License for more details. + + You can receive a copy of the GNU Affero General Public License from + <http://www.gnu.org/licenses/> + + @author Özgür Kesim <oec-taler@kesim.org> +*/ + +type Project struct { + Id int + Name string + Description string + Status KeyVal + ViewState KeyVal `json:"view_state"` + Enabled bool + InheritGlobal bool `json:"inherit_global"` + AccessLevel KeyVal `json:"AccessLevel"` + Versions Versions + Categories Categories + // CustomFields []any `json:"custom_fields"` +} + +type Versions []Version +type Version struct { + KeyVal + Description string + Released bool + Obsolete bool + Timestamp time.Time +} + +type VersionsByDate []Version + +func (v VersionsByDate) Len() int { return len(v) } +func (v VersionsByDate) Less(i, j int) bool { return v[i].Timestamp.Before(v[j].Timestamp) } +func (v VersionsByDate) Swap(i, j int) { v[i], v[j] = v[j], v[i] } + +type Categories []Category +type Category struct { + KeyVal + Project KeyVal +} + +func (vs VersionsByDate) Get(version string) *Version { + for i, v := range vs { + if v.Name == version { + return &vs[i] + } + } + return nil +} |