Extract OpenAPI schemas to separate file and move models to internal/model package
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Split api/openapi.yaml schemas into api/schemas.yaml so structs can be generated independently from the API server code. Models now generate into internal/model/ via oapi-codegen, with the server referencing them through import-mapping. Moved PtrTo helper to internal/utils and removed storage.ReportSummary in favor of model.TestSummary.
This commit is contained in:
parent
3eec5ce966
commit
396c51974a
47 changed files with 1878 additions and 1785 deletions
|
|
@ -25,36 +25,37 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
|
||||
"git.happydns.org/happyDeliver/internal/api"
|
||||
"git.happydns.org/happyDeliver/internal/model"
|
||||
"git.happydns.org/happyDeliver/internal/utils"
|
||||
)
|
||||
|
||||
// checkMXRecords looks up MX records for a domain
|
||||
func (d *DNSAnalyzer) checkMXRecords(domain string) *[]api.MXRecord {
|
||||
func (d *DNSAnalyzer) checkMXRecords(domain string) *[]model.MXRecord {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), d.Timeout)
|
||||
defer cancel()
|
||||
|
||||
mxRecords, err := d.resolver.LookupMX(ctx, domain)
|
||||
if err != nil {
|
||||
return &[]api.MXRecord{
|
||||
return &[]model.MXRecord{
|
||||
{
|
||||
Valid: false,
|
||||
Error: api.PtrTo(fmt.Sprintf("Failed to lookup MX records: %v", err)),
|
||||
Error: utils.PtrTo(fmt.Sprintf("Failed to lookup MX records: %v", err)),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
if len(mxRecords) == 0 {
|
||||
return &[]api.MXRecord{
|
||||
return &[]model.MXRecord{
|
||||
{
|
||||
Valid: false,
|
||||
Error: api.PtrTo("No MX records found"),
|
||||
Error: utils.PtrTo("No MX records found"),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
var results []api.MXRecord
|
||||
var results []model.MXRecord
|
||||
for _, mx := range mxRecords {
|
||||
results = append(results, api.MXRecord{
|
||||
results = append(results, model.MXRecord{
|
||||
Host: mx.Host,
|
||||
Priority: mx.Pref,
|
||||
Valid: true,
|
||||
|
|
@ -64,7 +65,7 @@ func (d *DNSAnalyzer) checkMXRecords(domain string) *[]api.MXRecord {
|
|||
return &results
|
||||
}
|
||||
|
||||
func (d *DNSAnalyzer) calculateMXScore(results *api.DNSResults) (score int) {
|
||||
func (d *DNSAnalyzer) calculateMXScore(results *model.DNSResults) (score int) {
|
||||
// Having valid MX records is critical for email deliverability
|
||||
// From domain MX records (half points) - needed for replies
|
||||
if results.FromMxRecords != nil && len(*results.FromMxRecords) > 0 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue