2023-12-27 03:06:11 +01:00
|
|
|
package main
|
2023-12-27 03:46:20 +01:00
|
|
|
|
2023-12-27 13:20:30 +01:00
|
|
|
import "time"
|
|
|
|
|
2023-12-27 03:46:20 +01:00
|
|
|
/*
|
|
|
|
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>
|
|
|
|
*/
|
2023-12-27 13:20:30 +01:00
|
|
|
|
|
|
|
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"`
|
2023-12-27 14:51:01 +01:00
|
|
|
Versions Versions
|
|
|
|
Categories Categories
|
2023-12-27 13:20:30 +01:00
|
|
|
// CustomFields []any `json:"custom_fields"`
|
|
|
|
}
|
|
|
|
|
2023-12-27 14:51:01 +01:00
|
|
|
type Versions []Version
|
2023-12-27 13:20:30 +01:00
|
|
|
type Version struct {
|
|
|
|
KeyVal
|
2023-12-27 14:51:01 +01:00
|
|
|
Description string
|
|
|
|
Released bool
|
|
|
|
Obsolete bool
|
|
|
|
Timestamp time.Time
|
2023-12-27 13:20:30 +01:00
|
|
|
}
|
|
|
|
|
2024-09-04 20:26:08 +02:00
|
|
|
type VersionsByDate Versions
|
2023-12-27 14:51:01 +01:00
|
|
|
|
|
|
|
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
|
2023-12-27 13:20:30 +01:00
|
|
|
type Category struct {
|
|
|
|
KeyVal
|
|
|
|
Project KeyVal
|
|
|
|
}
|
2023-12-27 14:51:01 +01:00
|
|
|
|
|
|
|
func (vs VersionsByDate) Get(version string) *Version {
|
|
|
|
for i, v := range vs {
|
|
|
|
if v.Name == version {
|
|
|
|
return &vs[i]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|