chore: Remove unused fields in FPL and DEP structs

The code changes remove the unused `SurveillanceEquipment` field in the `FPL` struct and the `TelegramCategory` field in the `DEP` struct. These fields are no longer needed and can be safely removed. This commit improves code cleanliness and reduces unnecessary complexity.
This commit is contained in:
windyboy
2024-07-20 10:40:28 +08:00
parent e394362554
commit 242e48d1b7
7 changed files with 158 additions and 90 deletions
+2 -2
View File
@@ -52,7 +52,7 @@ Description: This field contains any additional relevant information. It is opti
*/
// DEP 电报体中的起飞报文结构
type DEP struct {
TelegramCategory string `json:"telegram_category"` // 电报类别
Category string `json:"category"` // 电报类别
AircraftID string `json:"aircraft_id"` // 航空器识别标志
SSRModeAndCode string `json:"ssr_mode_and_code,omitempty"` // SSR 模式及编码(可选)
DepartureAirport string `json:"departure_airport"` // 起飞机场
@@ -65,7 +65,7 @@ type DEP struct {
// Validate validates the DEP struct fields
func (d *DEP) Validate() error {
if d.TelegramCategory == "" {
if d.Category == "" {
return fmt.Errorf("telegram category is required")
}
if d.AircraftID == "" {
+2 -2
View File
@@ -13,7 +13,7 @@ var _ = Describe("DEP", func() {
BeforeEach(func() {
original = DEP{
TelegramCategory: "DEP",
Category: "DEP",
AircraftID: "ABCD1234",
SSRModeAndCode: "A1234",
DepartureAirport: "JFK",
@@ -45,7 +45,7 @@ var _ = Describe("DEP", func() {
It("should fail validation for missing required fields", func() {
invalidDEP := DEP{
TelegramCategory: "DEP",
Category: "DEP",
// AircraftID is missing
DepartureAirport: "JFK",
DepartureTime: "150405",
-4
View File
@@ -57,7 +57,6 @@ type FPL struct {
AlternateAirport string `json:"alternate_airport,omitempty"` // 目的地备降机场(可选): Alternate airport (e.g., 'ZBYN').
OtherInfo string `json:"other_info,omitempty"` // 其他信息(可选): Other information.
SupplementaryInfo string `json:"supplementary_info,omitempty"` // 补充信息(可选): Supplementary information.
SurveillanceEquipment string `json:"surveillance_equipment"` // 监视设备信息: Surveillance equipment information (e.g., 'SDE3FGHIJ4J5M1RWY').
EstimatedArrivalTime string `json:"estimated_arrival_time"` // 预计到达时间: Estimated time of arrival (e.g., '0153').
PBN string `json:"pbn"` // 性能导航: Performance-based navigation equipment (e.g., 'A1B2B3B4B5D1L1').
NavigationEquipment string `json:"navigation_equipment"` // 导航设备: Navigation equipment (e.g., 'NAV/ABAS').
@@ -98,9 +97,6 @@ func (f *FPL) Validate() error {
if f.DestinationAndTotalTime == "" {
return fmt.Errorf("destination and total time is required")
}
if f.SurveillanceEquipment == "" {
return fmt.Errorf("surveillance equipment is required")
}
if f.EstimatedArrivalTime == "" {
return fmt.Errorf("estimated arrival time is required")
}
-1
View File
@@ -27,7 +27,6 @@ var _ = Describe("FPL", func() {
AlternateAirport: "SFO", // Example alternate airport
OtherInfo: "Test flight",
SupplementaryInfo: "Supplementary information",
SurveillanceEquipment: "SDE3FGHIJ4J5M1RWY",
EstimatedArrivalTime: "0153", // Example estimated arrival time
PBN: "A1B2B3B4B5D1L1",
NavigationEquipment: "NAV/ABAS",