From 729eb88621098b513c43858d6acddaafee12c5bf Mon Sep 17 00:00:00 2001
From: alexanderkohler1 <alexander1.kohler@student.reutlingen-university.de>
Date: Sun, 15 Jun 2025 20:51:41 +0200
Subject: [PATCH] =?UTF-8?q?Projekt-Model=20um=20UUID=20und=20K=C3=BCrzel-F?=
=?UTF-8?q?elder=20erweitert?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- UUID-Feld für eindeutige externe Projektidentifikation hinzugefügt
- Kürzel-Feld für benutzerdefinierte Projektabkürzungen (max 8 Zeichen)
- Felder in ProjectToCreate und ProjectToUpdate Strukturen integriert
---
src/app/project/model.go | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/src/app/project/model.go b/src/app/project/model.go
index 0697f43..e3bbfbc 100644
--- a/src/app/project/model.go
+++ b/src/app/project/model.go
@@ -15,10 +15,18 @@ type Project struct {
// The omitempty tag excludes this field if it's empty during insertion
ID primitive.ObjectID `bson:"_id,omitempty" json:"id"`
+ // UUID is a unique identifier for this project that can be used across systems
+ // Generated automatically when creating new projects for guaranteed uniqueness
+ UUID uuid.UUID `bson:"uuid" json:"uuid"`
+
// ProjectID is a human-readable unique identifier (e.g., "PRJ-2025-001")
// This allows users to reference projects with meaningful IDs
ProjectID string `bson:"project_id" json:"projectId"`
+ // Shortcut is a user-defined abbreviation for quick project reference
+ // Must be unique within the system and allows faster project identification
+ Shortcut string `bson:"shortcut" json:"shortcut"`
+
// Name is the display name of the project (e.g., "HARMONY Mobile")
// This is what users see in the interface as the project title
Name string `bson:"name" json:"name"`
@@ -57,6 +65,10 @@ type ProjectToCreate struct {
// Validation ensures this field is not empty
ProjectID string `json:"projectId" hvalidate:"required"`
+ // Shortcut is a user-defined abbreviation that must be unique (max 8 characters)
+ // Used for quick project identification and references
+ Shortcut string `json:"shortcut" hvalidate:"required,max8"`
+
// Name is required and serves as the display title
// Validation ensures this field is not empty
Name string `json:"name" hvalidate:"required"`
@@ -85,6 +97,10 @@ type ProjectToUpdate struct {
// This field is populated from the URL parameter
ID primitive.ObjectID `bson:"_id" json:"id"`
+ // Shortcut can be updated and must remain unique (max 8 characters)
+ // Users can change the project abbreviation for better organization
+ Shortcut string `json:"shortcut" hvalidate:"required,max=8"`
+
// Name can be updated and is required to be non-empty
// Users can change the display name of their projects
Name string `json:"name" hvalidate:"required"`
@@ -108,6 +124,7 @@ type ProjectToUpdate struct {
func (p *Project) ToUpdate() *ProjectToUpdate {
return &ProjectToUpdate{
ID: p.ID, // Preserve the project identifier
+ Shortcut: p.Shortcut, // Current shortcut as default
Name: p.Name, // Current name as default
Description: p.Description, // Current description as default
StartDate: p.StartDate, // Current start date as default
@@ -140,10 +157,18 @@ type RequirementSummary struct {
// Used for linking to detailed requirement views
ID primitive.ObjectID `bson:"_id" json:"id"`
+ // UUID is a unique identifier for this requirement that can be used across systems
+ // Generated automatically when creating new requirements for guaranteed uniqueness
+ UUID uuid.UUID `bson:"uuid" json:"uuid"`
+
// RequirementID is a human-readable identifier for this requirement
// Generated automatically if not provided (e.g., "REQ-abc123")
RequirementID string `bson:"requirement_id" json:"requirementId"`
+ // Shortcut is a user-defined abbreviation for quick requirement reference
+ // Must be unique within the project and allows faster requirement identification
+ Shortcut string `bson:"shortcut" json:"shortcut"`
+
// Condition describes the circumstances under which this requirement applies
// This field comes from the requirement parsing and validation process
Condition string `bson:"condition" json:"condition"`
--
GitLab