fix: Code for category
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
@@ -11,8 +12,19 @@ import (
|
||||
type Category struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
ParentID *uuid.UUID `json:"parent_id"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
// slugPattern matches a slug: lowercase latin letters and digits in
|
||||
// dash-separated groups, e.g. "population", "land-use-2024".
|
||||
var slugPattern = regexp.MustCompile(`^[a-z0-9]+(?:-[a-z0-9]+)*$`)
|
||||
|
||||
// ValidSlug reports whether s is a valid slug (lowercase latin letters, digits,
|
||||
// and single dashes between groups; no leading, trailing, or repeated dashes).
|
||||
func ValidSlug(s string) bool {
|
||||
return slugPattern.MatchString(s)
|
||||
}
|
||||
|
||||
@@ -145,7 +145,6 @@ type YearColumn struct {
|
||||
type DatasetSummary struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
CategoryID uuid.UUID `json:"category_id"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Description *string `json:"description"`
|
||||
Unit *string `json:"unit"`
|
||||
@@ -160,7 +159,6 @@ type DatasetSummary struct {
|
||||
type Dataset struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
CategoryID uuid.UUID `json:"category_id"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Description *string `json:"description"`
|
||||
Unit *string `json:"unit"`
|
||||
|
||||
Reference in New Issue
Block a user