lint: remove unused code across api, comms, h3utils, html, middleware, minio, platform, rmo

Deleted files: api/compliance.go, api/debug.go, rmo/compliance.go, rmo/email.go,
rmo/mock.go, platform/publicreport/address.go

Removed unused functions/types from: api/api.go, api/configuration.go, api/district.go,
api/publicreport.go, api/sudo.go, api/types.go, comms/text/twilio.go,
comms/text/voipms.go, h3utils/h3.go, html/embed.go, html/form.go,
middleware/terminal.go, minio/client.go, platform/csv/csv.go,
platform/csv/flyover.go, platform/file/base.go, platform/file/upload.go,
platform/geocode/address.go, platform/types/service_request.go
This commit is contained in:
Eli Ribble 2026-05-09 14:47:56 +00:00
parent d74c24339e
commit 53a3f9816a
25 changed files with 6 additions and 975 deletions

View file

@ -295,9 +295,6 @@ func addError(ctx context.Context, txn bob.Tx, c *models.FileuploadCSV, row_numb
log.Info().Int32("id", r.ID).Int32("file_id", c.FileID).Str("msg", msg).Int32("row", row_number).Int32("col", column_number).Msg("Created CSV file error")
return nil
}
func addImportError(file *models.FileuploadFile, err error) {
log.Debug().Err(err).Int32("file_id", file.ID).Msg("Fake add import error")
}
func parseBool(s string) (bool, error) {
sl := strings.ToLower(s)
boolValue, err := strconv.ParseBool(sl)

View file

@ -273,61 +273,6 @@ func hasExistingPool(ctx context.Context, txn bob.Executor, setter *models.Fileu
Bool("exists", exists).Msg("checking pool exists")
return exists, nil
}
func insertPoollistRow(ctx context.Context, txn bob.Tx, file *models.FileuploadFile, c *models.FileuploadCSV, line_number int32, header_types []headerFlyoverEnum, header_names []string, row []string) (*models.FileuploadPool, error) {
tags := make(map[string]string, 0)
// Start with a setter with default values, comment out the required fields to ensure they're set
setter := models.FileuploadPoolSetter{
// AddressCity: omit.From(),
// AddressPostalCode: omit.From(),
// AddressStreet: omit.From(),
Committed: omit.From(false),
Condition: omit.From(enums.PoolconditiontypeUnknown),
Created: omit.From(time.Now()),
CreatorID: omit.From(file.CreatorID),
CSVFile: omit.From(file.ID),
Deleted: omitnull.FromPtr[time.Time](nil),
Geom: omitnull.FromPtr[string](nil),
H3cell: omitnull.FromPtr[string](nil),
// ID - generated
IsInDistrict: omit.From(false),
IsNew: omit.From(true),
LineNumber: omit.From(line_number),
Notes: omit.From(""),
PropertyOwnerName: omit.From(""),
PropertyOwnerPhoneE164: omitnull.FromPtr[string](nil),
ResidentOwned: omitnull.FromPtr[bool](nil),
ResidentPhoneE164: omitnull.FromPtr[string](nil),
// Can't set this via a Setter
// Tags: convertToPGData(tags),
}
for i, value := range row {
if value == "" {
continue
}
header_type := header_types[i]
switch header_type {
case headerFlyoverAddressLocality:
setter.AddressLocality = omit.From(value)
case headerFlyoverAddressPostalCode:
setter.AddressPostalCode = omit.From(value)
case headerFlyoverAddressStreet:
setter.AddressStreet = omit.From(value)
case headerFlyoverComment:
condition, err := parsePoolCondition(value)
if err == nil {
setter.Condition = omit.From(condition)
} else {
lint.LogOnErrCtx(func(ctx context.Context) error {
return addError(ctx, txn, c, int32(line_number), int32(i), fmt.Sprintf("'%s' is not a pool condition that we recognize. It should be one of %s", value, poolConditionValidValues()))
}, ctx, "add pool condition error")
continue
}
}
}
setter.Tags = omit.From(db.ConvertToPGData(tags))
return models.FileuploadPools.Insert(&setter).One(ctx, txn)
}
type parseHeaderFunc[EnumType any] = func(row []string) ([]EnumType, []string)

View file

@ -12,10 +12,6 @@ import (
//"github.com/rs/zerolog/log"
)
func audioFileContentWrite(audioUUID uuid.UUID, body io.Reader) error {
return nil
}
var collectionToExtension map[Collection]string = map[Collection]string{
CollectionAudioNormalized: "ogg",
CollectionAudioRaw: "raw",

View file

@ -33,19 +33,6 @@ func SaveFileUploads(r *http.Request, collection Collection) ([]Upload, error) {
}
return results, nil
}
func saveFileUploads(r *http.Request, collection Collection) ([]Upload, error) {
results := make([]Upload, 0)
for name, fheaders := range r.MultipartForm.File {
for _, headers := range fheaders {
upload, err := saveFileUpload(headers, collection)
if err != nil {
return results, fmt.Errorf("Failed to save upload '%s': %w", name, err)
}
results = append(results, upload)
}
}
return results, nil
}
func saveFileUpload(headers *multipart.FileHeader, collection Collection) (upload Upload, err error) {
file, err := headers.Open()
if err != nil {

View file

@ -13,10 +13,6 @@ import (
//"github.com/rs/zerolog/log"
)
type _rowWithID struct {
ID int32 `db:"id"`
}
// Ensure the provided address exists. If it doesn't add it to the database.
func EnsureAddress(ctx context.Context, txn db.Ex, a types.Address) (types.Address, error) {
existing, err := querypublic.AddressFromGID(ctx, txn, a.GID)

View file

@ -1,22 +0,0 @@
package publicreport
import (
"context"
"fmt"
"github.com/Gleipnir-Technology/nidus-sync/db"
querypublic "github.com/Gleipnir-Technology/nidus-sync/db/query/public"
"github.com/Gleipnir-Technology/nidus-sync/platform/types"
)
func loadAddresses(ctx context.Context, txn db.Tx, address_ids []int64) (results map[int32]types.Address, err error) {
addresses, err := querypublic.AddressesFromIDs(ctx, txn, address_ids)
if err != nil {
return nil, fmt.Errorf("query addresses: %w", err)
}
results = make(map[int32]types.Address, len(addresses))
for _, row := range addresses {
results[row.ID] = types.AddressFromModel(row)
}
return results, nil
}

View file

@ -50,14 +50,6 @@ func (srr ServiceRequest) Render(w http.ResponseWriter, r *http.Request) error {
return nil
}
func formatTime(t null.Val[time.Time]) string {
if t.IsNull() {
return ""
}
v := t.MustGet()
return v.Format("2006-01-02T15:04:05.000Z")
}
func toBool(t null.Val[int32]) *bool {
if t.IsNull() {
return nil