Skip to content

Commit 2bc5726

Browse files
committed
Fix validation
1 parent 81cd271 commit 2bc5726

4 files changed

Lines changed: 2 additions & 10 deletions

File tree

api/pkg/di/container.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ func NewContainer(projectID string) (container *Container) {
6060

6161
container.RegisterUserRoutes()
6262

63+
container.RegisterPhoneRoutes()
64+
6365
// this has to be last since it registers the /* route
6466
container.RegisterSwaggerRoutes()
6567

api/pkg/requests/phone_index_request.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
type PhoneIndex struct {
1111
request
1212
Skip string `json:"skip" query:"skip"`
13-
Owner string `json:"owner" query:"owner"`
1413
Query string `json:"query" query:"query"`
1514
Limit string `json:"limit" query:"limit"`
1615
}
@@ -21,7 +20,6 @@ func (input *PhoneIndex) Sanitize() PhoneIndex {
2120
input.Limit = "1"
2221
}
2322
input.Query = strings.TrimSpace(input.Query)
24-
input.Owner = input.sanitizeAddress(input.Owner)
2523
input.Skip = strings.TrimSpace(input.Skip)
2624
if input.Skip == "" {
2725
input.Skip = "0"

api/pkg/validators/message_handler_validator.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ func (validator MessageHandlerValidator) ValidateMessageReceive(_ context.Contex
4545
},
4646
"from": []string{
4747
"required",
48-
phoneNumberRule,
4948
},
5049
"content": []string{
5150
"required",
@@ -57,9 +56,6 @@ func (validator MessageHandlerValidator) ValidateMessageReceive(_ context.Contex
5756
"to": {
5857
"regex: The 'to' field must be a valid E.164 phone number: https://en.wikipedia.org/wiki/E.164",
5958
},
60-
"from": {
61-
"regex: The 'from' field must be a valid E.164 phone number: https://en.wikipedia.org/wiki/E.164",
62-
},
6359
},
6460
})
6561

api/pkg/validators/phone_handler_validator.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ func (validator *PhoneHandlerValidator) ValidateIndex(_ context.Context, request
4646
"query": []string{
4747
"max:100",
4848
},
49-
"owner": []string{
50-
"required",
51-
phoneNumberRule,
52-
},
5349
},
5450
})
5551
return v.ValidateStruct()

0 commit comments

Comments
 (0)