Passed
Push — main ( f24a32...53c867 )
by Acho
03:11
created

entities.PhoneAPIKey.TableName   A

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
dl 0
loc 2
rs 10
c 0
b 0
f 0
nop 0
1
package entities
2
3
import (
4
	"time"
5
6
	"github.com/google/uuid"
7
	"github.com/lib/pq"
8
)
9
10
// PhoneAPIKey represents the API key for a phone
11
type PhoneAPIKey struct {
12
	ID           uuid.UUID      `json:"id" gorm:"primaryKey;type:uuid;" example:"32343a19-da5e-4b1b-a767-3298a73703cb"`
13
	Name         string         `json:"name" example:"Business Phone Key"`
14
	UserID       UserID         `json:"user_id" example:"WB7DRDWrJZRGbYrv2CKGkqbzvqdC"`
15
	UserEmail    string         `json:"user_email" example:"[email protected]"`
16
	PhoneNumbers pq.StringArray `json:"phone_numbers" example:"[+18005550199,+18005550100]" gorm:"type:text[]" swaggertype:"array,string"`
17
	PhoneIDs     pq.StringArray `json:"phone_ids" example:"[32343a19-da5e-4b1b-a767-3298a73703cb,32343a19-da5e-4b1b-a767-3298a73703cc]" gorm:"type:text[]" swaggertype:"array,string"`
18
	APIKey       string         `json:"api_key" gorm:"uniqueIndex:idx_phone_api_key__api_key" example:"pk_DGW8NwQp7mxKaSZ72Xq9v6xxxxx"`
19
	CreatedAt    time.Time      `json:"created_at"  example:"2022-06-05T14:26:02.302718+03:00"`
20
	UpdatedAt    time.Time      `json:"updated_at"  example:"2022-06-05T14:26:02.302718+03:00"`
21
}
22
23
// TableName overrides the table name used by PhoneAPIKey
24
func (PhoneAPIKey) TableName() string {
25
	return "phone_api_keys"
26
}
27