* INFRA-3703 : Houston side changes to accomodate QA use case * INFRA-3703 : UT failure fix * INFRA-3703 : Minor changes * INFRA-3703 : Unique constraint * INFRA-3703 : Edit migration file * INFRA-3703 : PR review comments and UT's * INFRA-3703 : Channel name resolution
34 lines
962 B
Go
34 lines
962 B
Go
package incidentTeam
|
|
|
|
import (
|
|
"houston/model/incident"
|
|
"houston/model/team"
|
|
"time"
|
|
)
|
|
|
|
type IncidentTeamEntity struct {
|
|
ID uint `gorm:"primaryKey"`
|
|
IncidentID uint `gorm:"column:incident_id;not null;uniqueIndex:incident_team_incident_id_team_id_key"`
|
|
TeamID uint `gorm:"column:team_id;not null;uniqueIndex:incident_team_incident_id_team_id_key"`
|
|
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime"`
|
|
|
|
// Add foreign key constraints
|
|
Incident incident.IncidentEntity `gorm:"foreignKey:IncidentID"`
|
|
Team team.TeamEntity `gorm:"foreignKey:TeamID"`
|
|
}
|
|
|
|
func (IncidentTeamEntity) TableName() string {
|
|
return "incident_team"
|
|
}
|
|
|
|
func (entity IncidentTeamEntity) ToDTO() IncidentTeamDTO {
|
|
return IncidentTeamDTO{
|
|
ID: entity.ID,
|
|
IncidentID: entity.IncidentID,
|
|
TeamID: entity.TeamID,
|
|
CreatedAt: entity.CreatedAt,
|
|
Incident: entity.Incident.ToDTO(),
|
|
Team: *entity.Team.ToDTO(),
|
|
}
|
|
}
|