remove ids fk
This commit is contained in:
No files matched your search
@@ -0,0 +1,8 @@
|
|||||||
|
-- Modify "Specialist" table
|
||||||
|
ALTER TABLE "public"."Specialist" DROP CONSTRAINT "fk_Specialist_Unit", DROP COLUMN "Unit_Id", ADD CONSTRAINT "fk_Specialist_Unit" FOREIGN KEY ("Unit_Code") REFERENCES "public"."Unit" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
|
||||||
|
-- Modify "SpecialistPosition" table
|
||||||
|
ALTER TABLE "public"."SpecialistPosition" DROP CONSTRAINT "fk_SpecialistPosition_Specialist", DROP COLUMN "Specialist_Id", ADD CONSTRAINT "fk_SpecialistPosition_Specialist" FOREIGN KEY ("Specialist_Code") REFERENCES "public"."Specialist" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
|
||||||
|
-- Modify "Subspecialist" table
|
||||||
|
ALTER TABLE "public"."Subspecialist" DROP CONSTRAINT "fk_Subspecialist_Specialist", DROP COLUMN "Specialist_Id", ADD CONSTRAINT "fk_Subspecialist_Specialist" FOREIGN KEY ("Specialist_Code") REFERENCES "public"."Specialist" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
|
||||||
|
-- Modify "SubspecialistPosition" table
|
||||||
|
ALTER TABLE "public"."SubspecialistPosition" DROP CONSTRAINT "fk_SubspecialistPosition_Subspecialist", DROP COLUMN "Subspecialist_Id", ADD CONSTRAINT "fk_SubspecialistPosition_Subspecialist" FOREIGN KEY ("Subspecialist_Code") REFERENCES "public"."Subspecialist" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
h1:CT5nygEUOdVE27HmnMPqwLegXYbJ41grmTvFn7AH8D8=
|
h1:cgdcTn/j8rHYtIwewbtRo4C+ybSGaJgHR2Fpstbj6/o=
|
||||||
20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k=
|
20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k=
|
||||||
20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0=
|
20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0=
|
||||||
20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI=
|
20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI=
|
||||||
@@ -78,3 +78,4 @@ h1:CT5nygEUOdVE27HmnMPqwLegXYbJ41grmTvFn7AH8D8=
|
|||||||
20251106050412.sql h1:MiEMJ1HCFYnalKuq3Z38xJeogfBAMqsTv2sG4EF8dDw=
|
20251106050412.sql h1:MiEMJ1HCFYnalKuq3Z38xJeogfBAMqsTv2sG4EF8dDw=
|
||||||
20251106063418.sql h1:y3veDJPjKekOWLCZek/LgQwXPRhZtOppTfUXiqoL95s=
|
20251106063418.sql h1:y3veDJPjKekOWLCZek/LgQwXPRhZtOppTfUXiqoL95s=
|
||||||
20251106071906.sql h1:/TUZA3XpMY23qEJXdkTwlzrNMvSSl6JJniPcgAttBaw=
|
20251106071906.sql h1:/TUZA3XpMY23qEJXdkTwlzrNMvSSl6JJniPcgAttBaw=
|
||||||
|
20251106073157.sql h1:78txeibJ602DMD7huD618ZSMt6phSRzDNPTlo0PGyrc=
|
||||||
@@ -7,7 +7,6 @@ import (
|
|||||||
|
|
||||||
type Basic struct {
|
type Basic struct {
|
||||||
ecore.SmallMain // adjust this according to the needs
|
ecore.SmallMain // adjust this according to the needs
|
||||||
Specialist_Id *uint16 `json:"specialist_id" gorm:"not null"`
|
|
||||||
Specialist_Code *string `json:"specialist_code" gorm:"size:10"`
|
Specialist_Code *string `json:"specialist_code" gorm:"size:10"`
|
||||||
Code string `json:"code" gorm:"unique;size:10;not null"`
|
Code string `json:"code" gorm:"unique;size:10;not null"`
|
||||||
Name string `json:"name" gorm:"size:30;not null"`
|
Name string `json:"name" gorm:"size:30;not null"`
|
||||||
|
|||||||
@@ -7,5 +7,5 @@ import (
|
|||||||
|
|
||||||
type SpecialistPosition struct {
|
type SpecialistPosition struct {
|
||||||
esb.Basic
|
esb.Basic
|
||||||
Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Id;references:Id"`
|
Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Code;references:Code"`
|
||||||
}
|
}
|
||||||
@@ -11,9 +11,8 @@ type Specialist struct {
|
|||||||
ecore.SmallMain // adjust this according to the needs
|
ecore.SmallMain // adjust this according to the needs
|
||||||
Code string `json:"code" gorm:"unique;size:10"`
|
Code string `json:"code" gorm:"unique;size:10"`
|
||||||
Name string `json:"name" gorm:"size:50"`
|
Name string `json:"name" gorm:"size:50"`
|
||||||
Unit_Id *uint16 `json:"unit_id"`
|
|
||||||
Unit_Code *string `json:"unit_code" gorm:"size:10"`
|
Unit_Code *string `json:"unit_code" gorm:"size:10"`
|
||||||
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id"`
|
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Code;references:Code"`
|
||||||
SpecialistPositions []eub.Basic `json:"specialistPositions,omitempty" gorm:"foreignKey:Specialist_Id;references:Id"`
|
SpecialistPositions []eub.Basic `json:"specialistPositions,omitempty" gorm:"foreignKey:Specialist_Code;references:Code"`
|
||||||
Subspecialists []essb.Basic `json:"subspecialists,omitempty" gorm:"foreignKey:Specialist_Id;references:Id"`
|
Subspecialists []essb.Basic `json:"subspecialists,omitempty" gorm:"foreignKey:Specialist_Code;references:Code"`
|
||||||
}
|
}
|
||||||
@@ -7,7 +7,6 @@ import (
|
|||||||
|
|
||||||
type Basic struct {
|
type Basic struct {
|
||||||
ecore.SmallMain // adjust this according to the needs
|
ecore.SmallMain // adjust this according to the needs
|
||||||
Subspecialist_Id *uint16 `json:"subspecialist_id" gorm:"not null"`
|
|
||||||
Subspecialist_Code *string `json:"subspecialist_code" gorm:"size:10"`
|
Subspecialist_Code *string `json:"subspecialist_code" gorm:"size:10"`
|
||||||
Code string `json:"code" gorm:"unique;size:10;not null"`
|
Code string `json:"code" gorm:"unique;size:10;not null"`
|
||||||
Name string `json:"name" gorm:"size:30;not null"`
|
Name string `json:"name" gorm:"size:30;not null"`
|
||||||
|
|||||||
@@ -7,5 +7,5 @@ import (
|
|||||||
|
|
||||||
type SubspecialistPosition struct {
|
type SubspecialistPosition struct {
|
||||||
esb.Basic
|
esb.Basic
|
||||||
Subspecialist *es.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Id;references:Id"`
|
Subspecialist *es.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Code;references:Code"`
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,6 @@ type Basic struct {
|
|||||||
ecore.SmallMain // adjust this according to the needs
|
ecore.SmallMain // adjust this according to the needs
|
||||||
Code string `json:"code" gorm:"unique;size:10"`
|
Code string `json:"code" gorm:"unique;size:10"`
|
||||||
Name string `json:"name" gorm:"size:50"`
|
Name string `json:"name" gorm:"size:50"`
|
||||||
Specialist_Id *uint16 `json:"specialist_id"`
|
|
||||||
Specialist_Code *string `json:"specialist_code" gorm:"size:10"`
|
Specialist_Code *string `json:"specialist_code" gorm:"size:10"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type CreateDto struct {
|
type CreateDto struct {
|
||||||
Code string `json:"code" validate:"maxLength=10"`
|
Code string `json:"code" validate:"maxLength=10"`
|
||||||
Name string `json:"name" validate:"maxLength=50"`
|
Name string `json:"name" validate:"maxLength=50"`
|
||||||
Specialist_Id *uint16 `json:"specialist_id"`
|
Specialist_Code *string `json:"specialist_code"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ReadListDto struct {
|
type ReadListDto struct {
|
||||||
@@ -20,10 +20,10 @@ type ReadListDto struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type FilterDto struct {
|
type FilterDto struct {
|
||||||
Code *string `json:"code"`
|
Code *string `json:"code"`
|
||||||
Name *string `json:"name"`
|
Name *string `json:"name"`
|
||||||
Specialist_Id *uint16 `json:"specialist-id"`
|
Specialist_Code *string `json:"specialist-code"`
|
||||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ReadDetailDto struct {
|
type ReadDetailDto struct {
|
||||||
@@ -52,7 +52,7 @@ type ResponseDto struct {
|
|||||||
ecore.SmallMain
|
ecore.SmallMain
|
||||||
Code string `json:"code"`
|
Code string `json:"code"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Specialist_Code *string `json:"specialist_ccode"`
|
Specialist_Code *string `json:"specialist_code"`
|
||||||
Specialist *es.Specialist `json:"specialist,omitempty"`
|
Specialist *es.Specialist `json:"specialist,omitempty"`
|
||||||
Subspecialist []espb.Basic `json:"subspecialistPositions,omitempty"`
|
Subspecialist []espb.Basic `json:"subspecialistPositions,omitempty"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,6 @@ import (
|
|||||||
|
|
||||||
type Subspecialist struct {
|
type Subspecialist struct {
|
||||||
esb.Basic
|
esb.Basic
|
||||||
Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Id"`
|
Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Code;references:Code"`
|
||||||
SubspecialistPositions []espb.Basic `json:"subspecialistPositions,omitempty" gorm:"foreignKey:Subspecialist_Id;references:Id"`
|
SubspecialistPositions []espb.Basic `json:"subspecialistPositions,omitempty" gorm:"foreignKey:Subspecialist_Code;references:Code"`
|
||||||
}
|
}
|
||||||
@@ -19,5 +19,5 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.Subspecialist) {
|
|||||||
|
|
||||||
data.Code = inputSrc.Code
|
data.Code = inputSrc.Code
|
||||||
data.Name = inputSrc.Name
|
data.Name = inputSrc.Name
|
||||||
data.Specialist_Id = inputSrc.Specialist_Id
|
data.Specialist_Code = inputSrc.Specialist_Code
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user