57 lines
1.5 KiB
Go
57 lines
1.5 KiB
Go
package data
|
|
|
|
import (
|
|
"actatempus_backend/internal/domain/entities"
|
|
"actatempus_backend/internal/infrastructure/data/db"
|
|
)
|
|
|
|
// Maps a Prisma User model to the domain User model.
|
|
func mapPrismaUserToDomain(user db.UserDboModel) entities.User {
|
|
return entities.User{
|
|
ID: user.ID,
|
|
Name: user.Name,
|
|
Email: user.Email,
|
|
Password: user.Password,
|
|
CreatedAt: user.CreatedAt,
|
|
UpdatedAt: user.UpdatedAt,
|
|
}
|
|
}
|
|
|
|
func mapPrismaProjectToDomain(project db.ProjectDboModel) entities.Project {
|
|
return entities.Project{
|
|
ID: project.ID,
|
|
Name: project.Name,
|
|
UserID: project.UserID,
|
|
Description: NullableField(project.Description),
|
|
ClientID: NullableField(project.ClientID),
|
|
CreatedAt: project.CreatedAt,
|
|
UpdatedAt: project.UpdatedAt,
|
|
}
|
|
}
|
|
|
|
|
|
func mapPrismaTimeEntryToDomain(timeEntry db.TimeEntryDboModel) entities.TimeEntry {
|
|
return entities.TimeEntry{
|
|
ID: timeEntry.ID,
|
|
ProjectID: timeEntry.ProjectID,
|
|
UserID: timeEntry.UserID,
|
|
StartTime: timeEntry.StartTime,
|
|
EndTime: NullableField(timeEntry.EndTime),
|
|
Description: NullableField(timeEntry.Description),
|
|
CreatedAt: timeEntry.CreatedAt,
|
|
UpdatedAt: timeEntry.UpdatedAt,
|
|
}
|
|
}
|
|
|
|
|
|
func mapPrismaProjectTaskToDomain(projectTask db.ProjectTaskDboModel) entities.ProjectTask {
|
|
return entities.ProjectTask{
|
|
ID: projectTask.ID,
|
|
ProjectID: projectTask.ProjectID,
|
|
Name: projectTask.Name,
|
|
Description: NullableField(projectTask.Description),
|
|
CreatedAt: projectTask.CreatedAt,
|
|
UpdatedAt: projectTask.UpdatedAt,
|
|
}
|
|
}
|