remove field Name

This commit is contained in:
Nam Huynh 2021-08-17 11:38:27 +07:00
parent 561886eb2f
commit 20cd83e7ac
4 changed files with 3 additions and 8 deletions

View File

@ -37,7 +37,6 @@ func (s Service) FindAllDevicesByOwnerID(ownerID string) []ResponseDevice {
result = append(result, ResponseDevice{
ID: doc.ID,
IP: doc.IP,
Name: doc.Name,
Platform: doc.Platform,
OS: ResponseOS{
Name: doc.OSName,

View File

@ -13,7 +13,6 @@ import (
type UpsertPayload struct {
DeviceID string
IP string
Name string
UserAgent string
AuthToken string
FCMToken string
@ -41,12 +40,12 @@ func (s Service) Upsert(payload UpsertPayload) {
// If not exist, create new
stm, args, _ := s.Builder.Insert(TableDeviceMngt).
Columns(
"id", "device_id", "ip", "name", "platform",
"id", "device_id", "ip", "platform",
"os_name", "os_version", "browser_name", "browser_version",
"auth_token", "fcm_token", "owner_id", "owner_type",
"first_sign_in_at", "last_activity_at",
).Values(
mongodb.NewStringID(), payload.DeviceID, payload.IP, payload.Name, platform,
mongodb.NewStringID(), payload.DeviceID, payload.IP, platform,
osInfo.Name, osInfo.Version, browserName, browserVersion,
payload.AuthToken, payload.FCMToken, payload.OwnerID, payload.OwnerType,
payload.FirstSignInAt, now(),
@ -62,7 +61,6 @@ func (s Service) Upsert(payload UpsertPayload) {
// Else update
stm, args, _ := s.Builder.Update(TableDeviceMngt).
Set("ip", payload.IP).
Set("name", payload.Name).
Set("platform", platform).
Set("os_name", osInfo.Name).
Set("os_version", osInfo.Version).

View File

@ -8,7 +8,7 @@ import (
// findByDeviceID ...
func (s Service) findByDeviceID(ctx context.Context, id string) (result Device) {
stm, args, _ := s.Builder.Select("*").From(DeviceMngtTableName).Where("device_id = ?", id).ToSql()
stm, args, _ := s.Builder.Select("*").From(TableDeviceMngt).Where("device_id = ?", id).ToSql()
if err := s.DB.GetContext(ctx, &result, stm, args...); err != nil {
logger.Error("devicemngt - findByDeviceID", logger.LogData{

View File

@ -7,7 +7,6 @@ type Device struct {
ID string `db:"id"`
DeviceID string `db:"device_id"`
IP string `db:"ip"`
Name string `db:"name"`
Platform string `db:"platform"`
OSName string `db:"os_name"`
OSVersion string `db:"os_version"`
@ -25,7 +24,6 @@ type Device struct {
type ResponseDevice struct {
ID string `json:"id"`
IP string `json:"ip"`
Name string `json:"name"`
Platform string `json:"platform"`
OS ResponseOS `json:"os"`
Browser ResponseBrowser `json:"browser"`