feat: Introduce base entity structure and update DTOs for Activity, Company, User, and TimeEntry
This commit is contained in:
		
							parent
							
								
									9749d5658c
								
							
						
					
					
						commit
						837cd55a33
					
				@ -5,7 +5,7 @@ import (
 | 
				
			|||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type Activity struct {
 | 
					type Activity struct {
 | 
				
			||||||
	ID          ulid.ULID
 | 
						EntityBase
 | 
				
			||||||
	Name        string
 | 
						Name        string
 | 
				
			||||||
	BillingRate float64
 | 
						BillingRate float64
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										14
									
								
								backend/internal/domain/entities/base.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								backend/internal/domain/entities/base.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,14 @@
 | 
				
			|||||||
 | 
					package entities
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import (
 | 
				
			||||||
 | 
						"time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						"github.com/oklog/ulid/v2"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					type EntityBase struct {
 | 
				
			||||||
 | 
						ID           ulid.ULID
 | 
				
			||||||
 | 
						CreatedAt    time.Time
 | 
				
			||||||
 | 
						UpdatedAt    time.Time
 | 
				
			||||||
 | 
						LastEditorID ulid.ULID
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -3,7 +3,7 @@ package entities
 | 
				
			|||||||
import "github.com/oklog/ulid/v2"
 | 
					import "github.com/oklog/ulid/v2"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type Company struct {
 | 
					type Company struct {
 | 
				
			||||||
	ID   ulid.ULID
 | 
						EntityBase
 | 
				
			||||||
	Name string
 | 
						Name string
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -7,7 +7,7 @@ import (
 | 
				
			|||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type TimeEntry struct {
 | 
					type TimeEntry struct {
 | 
				
			||||||
	ID          ulid.ULID
 | 
						EntityBase
 | 
				
			||||||
	UserID      int
 | 
						UserID      int
 | 
				
			||||||
	ProjectID   int
 | 
						ProjectID   int
 | 
				
			||||||
	ActivityID  int
 | 
						ActivityID  int
 | 
				
			||||||
 | 
				
			|||||||
@ -3,7 +3,7 @@ package entities
 | 
				
			|||||||
import "github.com/oklog/ulid/v2"
 | 
					import "github.com/oklog/ulid/v2"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type User struct {
 | 
					type User struct {
 | 
				
			||||||
	ID         ulid.ULID
 | 
						EntityBase
 | 
				
			||||||
	Username   string
 | 
						Username   string
 | 
				
			||||||
	Password   string
 | 
						Password   string
 | 
				
			||||||
	Role       string
 | 
						Role       string
 | 
				
			||||||
 | 
				
			|||||||
@ -1,11 +1,16 @@
 | 
				
			|||||||
package dto
 | 
					package dto
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
 | 
						"time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/oklog/ulid/v2"
 | 
						"github.com/oklog/ulid/v2"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type ActivityDto struct {
 | 
					type ActivityDto struct {
 | 
				
			||||||
	ID           ulid.ULID `json:"id"`
 | 
						ID           ulid.ULID `json:"id"`
 | 
				
			||||||
 | 
						CreatedAt    time.Time `json:"createdAt"`
 | 
				
			||||||
 | 
						UpdatedAt    time.Time `json:"updatedAt"`
 | 
				
			||||||
 | 
						LastEditorID ulid.ULID `json:"lastEditorID"`
 | 
				
			||||||
	Name         string    `json:"name"`
 | 
						Name         string    `json:"name"`
 | 
				
			||||||
	BillingRate  float64   `json:"billingRate"`
 | 
						BillingRate  float64   `json:"billingRate"`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -17,6 +22,9 @@ type ActivityCreateDto struct {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
type ActivityUpdateDto struct {
 | 
					type ActivityUpdateDto struct {
 | 
				
			||||||
	ID           ulid.ULID  `json:"id"`
 | 
						ID           ulid.ULID  `json:"id"`
 | 
				
			||||||
 | 
						CreatedAt    *time.Time `json:"createdAt"`
 | 
				
			||||||
 | 
						UpdatedAt    *time.Time `json:"updatedAt"`
 | 
				
			||||||
 | 
						LastEditorID *ulid.ULID `json:"lastEditorID"`
 | 
				
			||||||
	Name         *string    `json:"name"`
 | 
						Name         *string    `json:"name"`
 | 
				
			||||||
	BillingRate  *float64   `json:"billingRate"`
 | 
						BillingRate  *float64   `json:"billingRate"`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,11 +1,16 @@
 | 
				
			|||||||
package dto
 | 
					package dto
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
 | 
						"time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/oklog/ulid/v2"
 | 
						"github.com/oklog/ulid/v2"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type CompanyDto struct {
 | 
					type CompanyDto struct {
 | 
				
			||||||
	ID           ulid.ULID `json:"id"`
 | 
						ID           ulid.ULID `json:"id"`
 | 
				
			||||||
 | 
						CreatedAt    time.Time `json:"createdAt"`
 | 
				
			||||||
 | 
						UpdatedAt    time.Time `json:"updatedAt"`
 | 
				
			||||||
 | 
						LastEditorID ulid.ULID `json:"lastEditorID"`
 | 
				
			||||||
	Name         string    `json:"name"`
 | 
						Name         string    `json:"name"`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -15,5 +20,8 @@ type CompanyCreateDto struct {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
type CompanyUpdateDto struct {
 | 
					type CompanyUpdateDto struct {
 | 
				
			||||||
	ID           ulid.ULID  `json:"id"`
 | 
						ID           ulid.ULID  `json:"id"`
 | 
				
			||||||
 | 
						CreatedAt    *time.Time `json:"createdAt"`
 | 
				
			||||||
 | 
						UpdatedAt    *time.Time `json:"updatedAt"`
 | 
				
			||||||
 | 
						LastEditorID *ulid.ULID `json:"lastEditorID"`
 | 
				
			||||||
	Name         *string    `json:"name"`
 | 
						Name         *string    `json:"name"`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,11 +1,16 @@
 | 
				
			|||||||
package dto
 | 
					package dto
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
 | 
						"time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/oklog/ulid/v2"
 | 
						"github.com/oklog/ulid/v2"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type CustomerDto struct {
 | 
					type CustomerDto struct {
 | 
				
			||||||
	ID           ulid.ULID `json:"id"`
 | 
						ID           ulid.ULID `json:"id"`
 | 
				
			||||||
 | 
						CreatedAt    time.Time `json:"createdAt"`
 | 
				
			||||||
 | 
						UpdatedAt    time.Time `json:"updatedAt"`
 | 
				
			||||||
 | 
						LastEditorID ulid.ULID `json:"lastEditorID"`
 | 
				
			||||||
	Name         string    `json:"name"`
 | 
						Name         string    `json:"name"`
 | 
				
			||||||
	CompanyID    int       `json:"companyId"`
 | 
						CompanyID    int       `json:"companyId"`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -17,6 +22,9 @@ type CustomerCreateDto struct {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
type CustomerUpdateDto struct {
 | 
					type CustomerUpdateDto struct {
 | 
				
			||||||
	ID           ulid.ULID  `json:"id"`
 | 
						ID           ulid.ULID  `json:"id"`
 | 
				
			||||||
 | 
						CreatedAt    *time.Time `json:"createdAt"`
 | 
				
			||||||
 | 
						UpdatedAt    *time.Time `json:"updatedAt"`
 | 
				
			||||||
 | 
						LastEditorID *ulid.ULID `json:"lastEditorID"`
 | 
				
			||||||
	Name         *string    `json:"name"`
 | 
						Name         *string    `json:"name"`
 | 
				
			||||||
	CompanyID    *int       `json:"companyId"`
 | 
						CompanyID    *int       `json:"companyId"`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,11 +1,16 @@
 | 
				
			|||||||
package dto
 | 
					package dto
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
 | 
						"time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/oklog/ulid/v2"
 | 
						"github.com/oklog/ulid/v2"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type ProjectDto struct {
 | 
					type ProjectDto struct {
 | 
				
			||||||
	ID           ulid.ULID `json:"id"`
 | 
						ID           ulid.ULID `json:"id"`
 | 
				
			||||||
 | 
						CreatedAt    time.Time `json:"createdAt"`
 | 
				
			||||||
 | 
						UpdatedAt    time.Time `json:"updatedAt"`
 | 
				
			||||||
 | 
						LastEditorID ulid.ULID `json:"lastEditorID"`
 | 
				
			||||||
	Name         string    `json:"name"`
 | 
						Name         string    `json:"name"`
 | 
				
			||||||
	CustomerID   int       `json:"customerId"`
 | 
						CustomerID   int       `json:"customerId"`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -17,6 +22,9 @@ type ProjectCreateDto struct {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
type ProjectUpdateDto struct {
 | 
					type ProjectUpdateDto struct {
 | 
				
			||||||
	ID           ulid.ULID  `json:"id"`
 | 
						ID           ulid.ULID  `json:"id"`
 | 
				
			||||||
 | 
						CreatedAt    *time.Time `json:"createdAt"`
 | 
				
			||||||
 | 
						UpdatedAt    *time.Time `json:"updatedAt"`
 | 
				
			||||||
 | 
						LastEditorID *ulid.ULID `json:"lastEditorID"`
 | 
				
			||||||
	Name         *string    `json:"name"`
 | 
						Name         *string    `json:"name"`
 | 
				
			||||||
	CustomerID   *int       `json:"customerId"`
 | 
						CustomerID   *int       `json:"customerId"`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -8,6 +8,9 @@ import (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
type TimeEntryDto struct {
 | 
					type TimeEntryDto struct {
 | 
				
			||||||
	ID           ulid.ULID `json:"id"`
 | 
						ID           ulid.ULID `json:"id"`
 | 
				
			||||||
 | 
						CreatedAt    time.Time `json:"createdAt"`
 | 
				
			||||||
 | 
						UpdatedAt    time.Time `json:"updatedAt"`
 | 
				
			||||||
 | 
						LastEditorID ulid.ULID `json:"lastEditorID"`
 | 
				
			||||||
	UserID       int       `json:"userId"`
 | 
						UserID       int       `json:"userId"`
 | 
				
			||||||
	ProjectID    int       `json:"projectId"`
 | 
						ProjectID    int       `json:"projectId"`
 | 
				
			||||||
	ActivityID   int       `json:"activityId"`
 | 
						ActivityID   int       `json:"activityId"`
 | 
				
			||||||
@ -29,6 +32,9 @@ type TimeEntryCreateDto struct {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
type TimeEntryUpdateDto struct {
 | 
					type TimeEntryUpdateDto struct {
 | 
				
			||||||
	ID           ulid.ULID  `json:"id"`
 | 
						ID           ulid.ULID  `json:"id"`
 | 
				
			||||||
 | 
						CreatedAt    *time.Time `json:"createdAt"`
 | 
				
			||||||
 | 
						UpdatedAt    *time.Time `json:"updatedAt"`
 | 
				
			||||||
 | 
						LastEditorID *ulid.ULID `json:"lastEditorID"`
 | 
				
			||||||
	UserID       *int       `json:"userId"`
 | 
						UserID       *int       `json:"userId"`
 | 
				
			||||||
	ProjectID    *int       `json:"projectId"`
 | 
						ProjectID    *int       `json:"projectId"`
 | 
				
			||||||
	ActivityID   *int       `json:"activityId"`
 | 
						ActivityID   *int       `json:"activityId"`
 | 
				
			||||||
 | 
				
			|||||||
@ -1,11 +1,16 @@
 | 
				
			|||||||
package dto
 | 
					package dto
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
 | 
						"time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/oklog/ulid/v2"
 | 
						"github.com/oklog/ulid/v2"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type UserDto struct {
 | 
					type UserDto struct {
 | 
				
			||||||
	ID           ulid.ULID `json:"id"`
 | 
						ID           ulid.ULID `json:"id"`
 | 
				
			||||||
 | 
						CreatedAt    time.Time `json:"createdAt"`
 | 
				
			||||||
 | 
						UpdatedAt    time.Time `json:"updatedAt"`
 | 
				
			||||||
 | 
						LastEditorID ulid.ULID `json:"lastEditorID"`
 | 
				
			||||||
	Username     string    `json:"username"`
 | 
						Username     string    `json:"username"`
 | 
				
			||||||
	Password     string    `json:"password"` // Note: In a real application, you would NEVER send the password in a DTO. This is just for demonstration.
 | 
						Password     string    `json:"password"` // Note: In a real application, you would NEVER send the password in a DTO. This is just for demonstration.
 | 
				
			||||||
	Role         string    `json:"role"`
 | 
						Role         string    `json:"role"`
 | 
				
			||||||
@ -23,6 +28,9 @@ type UserCreateDto struct {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
type UserUpdateDto struct {
 | 
					type UserUpdateDto struct {
 | 
				
			||||||
	ID           ulid.ULID  `json:"id"`
 | 
						ID           ulid.ULID  `json:"id"`
 | 
				
			||||||
 | 
						CreatedAt    *time.Time `json:"createdAt"`
 | 
				
			||||||
 | 
						UpdatedAt    *time.Time `json:"updatedAt"`
 | 
				
			||||||
 | 
						LastEditorID *ulid.ULID `json:"lastEditorID"`
 | 
				
			||||||
	Username     *string    `json:"username"`
 | 
						Username     *string    `json:"username"`
 | 
				
			||||||
	Password     *string    `json:"password"` // Note: In a real application, you would NEVER send the password in a DTO. This is just for demonstration.
 | 
						Password     *string    `json:"password"` // Note: In a real application, you would NEVER send the password in a DTO. This is just for demonstration.
 | 
				
			||||||
	Role         *string    `json:"role"`
 | 
						Role         *string    `json:"role"`
 | 
				
			||||||
 | 
				
			|||||||
@ -13,6 +13,8 @@ This document provides an overview of the Time Tracking and Management System. F
 | 
				
			|||||||
- [Extensibility and Integrations](extensibility_integrations.md)
 | 
					- [Extensibility and Integrations](extensibility_integrations.md)
 | 
				
			||||||
- [LLM Guidance](llm_guidance.md)
 | 
					- [LLM Guidance](llm_guidance.md)
 | 
				
			||||||
- [Roadmap](Roadmap.md)
 | 
					- [Roadmap](Roadmap.md)
 | 
				
			||||||
 | 
					- [Domain Types](domain_types.md)
 | 
				
			||||||
 | 
					- [DTOs](dtos.md)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Code Examples
 | 
					## Code Examples
 | 
				
			||||||
- [GORM Entities](code_examples/gorm_entities.go)
 | 
					- [GORM Entities](code_examples/gorm_entities.go)
 | 
				
			||||||
 | 
				
			|||||||
@ -13,6 +13,40 @@ CREATE TABLE companies (
 | 
				
			|||||||
    updated_at TIMESTAMP NOT NULL DEFAULT NOW()
 | 
					    updated_at TIMESTAMP NOT NULL DEFAULT NOW()
 | 
				
			||||||
);
 | 
					);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- Go structs for creating and updating customers
 | 
				
			||||||
 | 
					-- type CustomerCreate struct {
 | 
				
			||||||
 | 
					-- 	Name      string
 | 
				
			||||||
 | 
					-- 	CompanyID int
 | 
				
			||||||
 | 
					-- }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- type CustomerUpdate struct {
 | 
				
			||||||
 | 
					-- 	ID        ulid.ULID
 | 
				
			||||||
 | 
					-- 	Name      *string
 | 
				
			||||||
 | 
					-- 	CompanyID *int
 | 
				
			||||||
 | 
					-- }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- Go structs for creating and updating companies
 | 
				
			||||||
 | 
					-- type CompanyCreate struct {
 | 
				
			||||||
 | 
					-- 	Name string
 | 
				
			||||||
 | 
					-- }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- type CompanyUpdate struct {
 | 
				
			||||||
 | 
					-- 	ID   ulid.ULID
 | 
				
			||||||
 | 
					-- 	Name *string
 | 
				
			||||||
 | 
					-- }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- Go structs for creating and updating activities
 | 
				
			||||||
 | 
					-- type ActivityCreate struct {
 | 
				
			||||||
 | 
					-- 	Name        string
 | 
				
			||||||
 | 
					-- 	BillingRate float64
 | 
				
			||||||
 | 
					-- }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- type ActivityUpdate struct {
 | 
				
			||||||
 | 
					-- 	ID          ulid.ULID
 | 
				
			||||||
 | 
					-- 	Name        *string
 | 
				
			||||||
 | 
					-- 	BillingRate *float64
 | 
				
			||||||
 | 
					-- }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- Users and Roles
 | 
					-- Users and Roles
 | 
				
			||||||
CREATE TABLE roles (
 | 
					CREATE TABLE roles (
 | 
				
			||||||
    id SERIAL PRIMARY KEY,
 | 
					    id SERIAL PRIMARY KEY,
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										27
									
								
								docu/domain_types.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								docu/domain_types.md
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,27 @@
 | 
				
			|||||||
 | 
					# Domain Types
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This document describes the domain types used in the Time Tracker application. Domain types represent the core business concepts and are used throughout the application.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Activity
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The `Activity` type represents a specific activity that can be tracked, such as "Development", "Meeting", or "Bug Fixing".
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Company
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The `Company` type represents a tenant in the multi-tenant application. Each company has its own set of users, customers, projects, and activities.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Customer
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The `Customer` type represents a customer of a company.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Project
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The `Project` type represents a project for a specific customer.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## TimeEntry
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The `TimeEntry` type represents a time booking for a specific user, project, and activity.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## User
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The `User` type represents a user of the application. Each user belongs to a company and has a specific role.
 | 
				
			||||||
							
								
								
									
										27
									
								
								docu/dtos.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								docu/dtos.md
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,27 @@
 | 
				
			|||||||
 | 
					# Data Transfer Objects (DTOs)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This document describes the Data Transfer Objects (DTOs) used in the Time Tracker application. DTOs are used to transfer data between the backend and frontend, and between different layers of the backend.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## ActivityDto
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The `ActivityDto` type represents a specific activity that can be tracked, such as "Development", "Meeting", or "Bug Fixing". It is used to transfer activity data between the backend and frontend.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## CompanyDto
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The `CompanyDto` type represents a tenant in the multi-tenant application. Each company has its own set of users, customers, projects, and activities. It is used to transfer company data between the backend and frontend.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## CustomerDto
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The `CustomerDto` type represents a customer of a company. It is used to transfer customer data between the backend and frontend.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## ProjectDto
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The `ProjectDto` type represents a project for a specific customer. It is used to transfer project data between the backend and frontend.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## TimeEntryDto
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The `TimeEntryDto` type represents a time booking for a specific user, project, and activity. It is used to transfer time entry data between the backend and frontend.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## UserDto
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The `UserDto` type represents a user of the application. Each user belongs to a company and has a specific role. It is used to transfer user data between the backend and frontend.
 | 
				
			||||||
							
								
								
									
										6
									
								
								frontend/src/types/base.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								frontend/src/types/base.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					export type BaseEntity = {
 | 
				
			||||||
 | 
					    createdAt: Date;
 | 
				
			||||||
 | 
					    updatedAt: Date;
 | 
				
			||||||
 | 
					    lastEditorID: string;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -5,6 +5,9 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export interface ActivityDto {
 | 
					export interface ActivityDto {
 | 
				
			||||||
  id: string;
 | 
					  id: string;
 | 
				
			||||||
 | 
					  createdAt: string;
 | 
				
			||||||
 | 
					  updatedAt: string;
 | 
				
			||||||
 | 
					  lastEditorID: string;
 | 
				
			||||||
  name: string;
 | 
					  name: string;
 | 
				
			||||||
  billingRate: number /* float64 */;
 | 
					  billingRate: number /* float64 */;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -14,6 +17,9 @@ export interface ActivityCreateDto {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
export interface ActivityUpdateDto {
 | 
					export interface ActivityUpdateDto {
 | 
				
			||||||
  id: string;
 | 
					  id: string;
 | 
				
			||||||
 | 
					  createdAt?: string;
 | 
				
			||||||
 | 
					  updatedAt?: string;
 | 
				
			||||||
 | 
					  lastEditorID?: string;
 | 
				
			||||||
  name?: string;
 | 
					  name?: string;
 | 
				
			||||||
  billingRate?: number /* float64 */;
 | 
					  billingRate?: number /* float64 */;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -23,6 +29,9 @@ export interface ActivityUpdateDto {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export interface CompanyDto {
 | 
					export interface CompanyDto {
 | 
				
			||||||
  id: string;
 | 
					  id: string;
 | 
				
			||||||
 | 
					  createdAt: string;
 | 
				
			||||||
 | 
					  updatedAt: string;
 | 
				
			||||||
 | 
					  lastEditorID: string;
 | 
				
			||||||
  name: string;
 | 
					  name: string;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
export interface CompanyCreateDto {
 | 
					export interface CompanyCreateDto {
 | 
				
			||||||
@ -30,6 +39,9 @@ export interface CompanyCreateDto {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
export interface CompanyUpdateDto {
 | 
					export interface CompanyUpdateDto {
 | 
				
			||||||
  id: string;
 | 
					  id: string;
 | 
				
			||||||
 | 
					  createdAt?: string;
 | 
				
			||||||
 | 
					  updatedAt?: string;
 | 
				
			||||||
 | 
					  lastEditorID?: string;
 | 
				
			||||||
  name?: string;
 | 
					  name?: string;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -38,6 +50,9 @@ export interface CompanyUpdateDto {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export interface CustomerDto {
 | 
					export interface CustomerDto {
 | 
				
			||||||
  id: string;
 | 
					  id: string;
 | 
				
			||||||
 | 
					  createdAt: string;
 | 
				
			||||||
 | 
					  updatedAt: string;
 | 
				
			||||||
 | 
					  lastEditorID: string;
 | 
				
			||||||
  name: string;
 | 
					  name: string;
 | 
				
			||||||
  companyId: number /* int */;
 | 
					  companyId: number /* int */;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -47,6 +62,9 @@ export interface CustomerCreateDto {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
export interface CustomerUpdateDto {
 | 
					export interface CustomerUpdateDto {
 | 
				
			||||||
  id: string;
 | 
					  id: string;
 | 
				
			||||||
 | 
					  createdAt?: string;
 | 
				
			||||||
 | 
					  updatedAt?: string;
 | 
				
			||||||
 | 
					  lastEditorID?: string;
 | 
				
			||||||
  name?: string;
 | 
					  name?: string;
 | 
				
			||||||
  companyId?: number /* int */;
 | 
					  companyId?: number /* int */;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -56,6 +74,9 @@ export interface CustomerUpdateDto {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export interface ProjectDto {
 | 
					export interface ProjectDto {
 | 
				
			||||||
  id: string;
 | 
					  id: string;
 | 
				
			||||||
 | 
					  createdAt: string;
 | 
				
			||||||
 | 
					  updatedAt: string;
 | 
				
			||||||
 | 
					  lastEditorID: string;
 | 
				
			||||||
  name: string;
 | 
					  name: string;
 | 
				
			||||||
  customerId: number /* int */;
 | 
					  customerId: number /* int */;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -65,6 +86,9 @@ export interface ProjectCreateDto {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
export interface ProjectUpdateDto {
 | 
					export interface ProjectUpdateDto {
 | 
				
			||||||
  id: string;
 | 
					  id: string;
 | 
				
			||||||
 | 
					  createdAt?: string;
 | 
				
			||||||
 | 
					  updatedAt?: string;
 | 
				
			||||||
 | 
					  lastEditorID?: string;
 | 
				
			||||||
  name?: string;
 | 
					  name?: string;
 | 
				
			||||||
  customerId?: number /* int */;
 | 
					  customerId?: number /* int */;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -74,6 +98,9 @@ export interface ProjectUpdateDto {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export interface TimeEntryDto {
 | 
					export interface TimeEntryDto {
 | 
				
			||||||
  id: string;
 | 
					  id: string;
 | 
				
			||||||
 | 
					  createdAt: string;
 | 
				
			||||||
 | 
					  updatedAt: string;
 | 
				
			||||||
 | 
					  lastEditorID: string;
 | 
				
			||||||
  userId: number /* int */;
 | 
					  userId: number /* int */;
 | 
				
			||||||
  projectId: number /* int */;
 | 
					  projectId: number /* int */;
 | 
				
			||||||
  activityId: number /* int */;
 | 
					  activityId: number /* int */;
 | 
				
			||||||
@ -93,6 +120,9 @@ export interface TimeEntryCreateDto {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
export interface TimeEntryUpdateDto {
 | 
					export interface TimeEntryUpdateDto {
 | 
				
			||||||
  id: string;
 | 
					  id: string;
 | 
				
			||||||
 | 
					  createdAt?: string;
 | 
				
			||||||
 | 
					  updatedAt?: string;
 | 
				
			||||||
 | 
					  lastEditorID?: string;
 | 
				
			||||||
  userId?: number /* int */;
 | 
					  userId?: number /* int */;
 | 
				
			||||||
  projectId?: number /* int */;
 | 
					  projectId?: number /* int */;
 | 
				
			||||||
  activityId?: number /* int */;
 | 
					  activityId?: number /* int */;
 | 
				
			||||||
@ -107,6 +137,9 @@ export interface TimeEntryUpdateDto {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export interface UserDto {
 | 
					export interface UserDto {
 | 
				
			||||||
  id: string;
 | 
					  id: string;
 | 
				
			||||||
 | 
					  createdAt: string;
 | 
				
			||||||
 | 
					  updatedAt: string;
 | 
				
			||||||
 | 
					  lastEditorID: string;
 | 
				
			||||||
  username: string;
 | 
					  username: string;
 | 
				
			||||||
  password: string; // Note: In a real application, you would NEVER send the password in a DTO. This is just for demonstration.
 | 
					  password: string; // Note: In a real application, you would NEVER send the password in a DTO. This is just for demonstration.
 | 
				
			||||||
  role: string;
 | 
					  role: string;
 | 
				
			||||||
@ -122,6 +155,9 @@ export interface UserCreateDto {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
export interface UserUpdateDto {
 | 
					export interface UserUpdateDto {
 | 
				
			||||||
  id: string;
 | 
					  id: string;
 | 
				
			||||||
 | 
					  createdAt?: string;
 | 
				
			||||||
 | 
					  updatedAt?: string;
 | 
				
			||||||
 | 
					  lastEditorID?: string;
 | 
				
			||||||
  username?: string;
 | 
					  username?: string;
 | 
				
			||||||
  password?: string; // Note: In a real application, you would NEVER send the password in a DTO. This is just for demonstration.
 | 
					  password?: string; // Note: In a real application, you would NEVER send the password in a DTO. This is just for demonstration.
 | 
				
			||||||
  role?: string;
 | 
					  role?: string;
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										9
									
								
								frontend/src/types/value-ids.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								frontend/src/types/value-ids.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,9 @@
 | 
				
			|||||||
 | 
					export type ValueId<T = string> = string & { __valueId: T };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export type CustomerId = ValueId<"CustomerId">;
 | 
				
			||||||
 | 
					export type ProjectId = ValueId<"ProjectId">;
 | 
				
			||||||
 | 
					export type TimeEntryId = ValueId<"TimeEntryId">;
 | 
				
			||||||
 | 
					export type CompanyId = ValueId<"CompanyId">;
 | 
				
			||||||
 | 
					export type UserId = ValueId<"UserId">;
 | 
				
			||||||
 | 
					export type RoleId = ValueId<"RoleId">;
 | 
				
			||||||
 | 
					export type PermissionId = ValueId<"PermissionId">;
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user