Initial commit

This commit is contained in:
wangxuming
2026-07-12 15:53:24 +08:00
commit 68d61700d5
252 changed files with 23291 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
package httpapi
import (
"encoding/json"
"strings"
"testing"
"time"
"calllinesystem/server/internal/model"
)
func TestDisplayBatchDTOCannotSerializePersonalFields(t *testing.T) {
batch := model.CallBatch{BatchSequence: 7, Status: "CALLED", CalledAt: time.Unix(100, 0).UTC()}
view := newDisplayBatchDTO(batch, []displayTicketDTO{{
TicketNumber: "00042", DisplayNumber: "00042", Status: model.TicketCalled,
}})
body, err := json.Marshal(view)
if err != nil {
t.Fatal(err)
}
encoded := string(body)
for _, forbidden := range []string{"honorific", "phone", "phone_last4", "last_name", "ticket_id", "joined_at", "created_by"} {
if strings.Contains(encoded, forbidden) {
t.Fatalf("public display DTO leaked forbidden field %q: %s", forbidden, encoded)
}
}
if !strings.Contains(encoded, `"ticket_number":"00042"`) {
t.Fatalf("public ticket number missing: %s", encoded)
}
}