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{ result = append(result, ResponseDevice{
ID: doc.ID, ID: doc.ID,
IP: doc.IP, IP: doc.IP,
Name: doc.Name,
Platform: doc.Platform, Platform: doc.Platform,
OS: ResponseOS{ OS: ResponseOS{
Name: doc.OSName, Name: doc.OSName,

View File

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

View File

@ -8,7 +8,7 @@ import (
// findByDeviceID ... // findByDeviceID ...
func (s Service) findByDeviceID(ctx context.Context, id string) (result Device) { 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 { if err := s.DB.GetContext(ctx, &result, stm, args...); err != nil {
logger.Error("devicemngt - findByDeviceID", logger.LogData{ logger.Error("devicemngt - findByDeviceID", logger.LogData{

View File

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