mirror of
https://github.com/PretendoNetwork/friends.git
synced 2026-09-09 20:05:27 -05:00
fixed database usage of new DateTime API
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
package database_3ds
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/PretendoNetwork/friends/database"
|
||||
"github.com/PretendoNetwork/nex-go"
|
||||
friends_3ds_types "github.com/PretendoNetwork/nex-protocols-go/friends-3ds/types"
|
||||
@@ -19,8 +17,7 @@ func GetFriendMiis(pids []uint32) ([]*friends_3ds_types.FriendMii, error) {
|
||||
return friendMiis, err
|
||||
}
|
||||
|
||||
changedTime := nex.NewDateTime(0)
|
||||
changedTime.FromTimestamp(time.Now())
|
||||
changedTime := nex.NewDateTime(0).Now()
|
||||
|
||||
for rows.Next() {
|
||||
var pid uint32
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package database_3ds
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/PretendoNetwork/friends/database"
|
||||
"github.com/PretendoNetwork/nex-go"
|
||||
friends_3ds_types "github.com/PretendoNetwork/nex-protocols-go/friends-3ds/types"
|
||||
@@ -15,9 +13,6 @@ func SaveFriendship(senderPID uint32, recipientPID uint32) (*friends_3ds_types.F
|
||||
friendRelationship.LFC = 0
|
||||
friendRelationship.RelationshipType = 0 // * Incomplete
|
||||
|
||||
nowTime := nex.NewDateTime(0)
|
||||
nowTime.FromTimestamp(time.Now())
|
||||
|
||||
// * Ensure that we inputted a valid user.
|
||||
var found bool
|
||||
err := database.Postgres.QueryRow(`SELECT COUNT(*) FROM "3ds".user_data WHERE pid=$1 LIMIT 1`, recipientPID).Scan(&found)
|
||||
@@ -47,7 +42,7 @@ func SaveFriendship(senderPID uint32, recipientPID uint32) (*friends_3ds_types.F
|
||||
return friendRelationship, nil
|
||||
}
|
||||
|
||||
acceptedTime := nex.NewDateTime(0).Now()
|
||||
acceptedTime := nex.NewDateTime(0).Now().Value()
|
||||
|
||||
// * We need to have two relationships for both sides as friend relationships are not one single object.
|
||||
_, err = database.Postgres.Exec(`
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
// UpdateUserComment updates a user's comment
|
||||
func UpdateUserComment(pid uint32, message string) error {
|
||||
changed := nex.NewDateTime(0).Now()
|
||||
changed := nex.NewDateTime(0).Now().Value()
|
||||
|
||||
_, err := database.Postgres.Exec(`
|
||||
INSERT INTO "3ds".user_data (pid, comment, comment_changed)
|
||||
|
||||
@@ -15,7 +15,7 @@ func UpdateUserMii(pid uint32, mii *friends_3ds_types.Mii) error {
|
||||
DO UPDATE SET
|
||||
mii_name = $2,
|
||||
mii_data = $3,
|
||||
mii_changed = $4`, pid, mii.Name, mii.MiiData, nex.NewDateTime(0).Now())
|
||||
mii_changed = $4`, pid, mii.Name, mii.MiiData, nex.NewDateTime(0).Now().Value())
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -2,7 +2,6 @@ package database_wiiu
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"time"
|
||||
|
||||
"github.com/PretendoNetwork/friends/database"
|
||||
"github.com/PretendoNetwork/friends/globals"
|
||||
@@ -25,8 +24,7 @@ func AcceptFriendRequestAndReturnFriendInfo(friendRequestID uint64) (*friends_wi
|
||||
}
|
||||
}
|
||||
|
||||
acceptedTime := nex.NewDateTime(0)
|
||||
acceptedTime.FromTimestamp(time.Now())
|
||||
acceptedTime := nex.NewDateTime(0).Now()
|
||||
|
||||
// * Friendships are two-way relationships, not just one link between 2 entities
|
||||
// * "A" has friend "B" and "B" has friend "A", so store both relationships
|
||||
@@ -69,8 +67,7 @@ func AcceptFriendRequestAndReturnFriendInfo(friendRequestID uint64) (*friends_wi
|
||||
friendInfo.NNAInfo = connectedUser.NNAInfo
|
||||
friendInfo.Presence = connectedUser.PresenceV2
|
||||
|
||||
lastOnline = nex.NewDateTime(0)
|
||||
lastOnline.FromTimestamp(time.Now())
|
||||
lastOnline = nex.NewDateTime(0).Now()
|
||||
} else {
|
||||
// * Offline
|
||||
userInfo, err := utility.GetUserInfoByPID(senderPID)
|
||||
|
||||
@@ -3,7 +3,6 @@ package database_wiiu
|
||||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/PretendoNetwork/friends/database"
|
||||
"github.com/PretendoNetwork/friends/globals"
|
||||
@@ -51,8 +50,7 @@ func GetUserFriendList(pid uint32) ([]*friends_wiiu_types.FriendInfo, error) {
|
||||
continue
|
||||
}
|
||||
|
||||
lastOnline = nex.NewDateTime(0)
|
||||
lastOnline.FromTimestamp(time.Now())
|
||||
lastOnline = nex.NewDateTime(0).Now()
|
||||
} else {
|
||||
// * Offline
|
||||
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
package database_wiiu
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/PretendoNetwork/friends/database"
|
||||
"github.com/PretendoNetwork/nex-go"
|
||||
)
|
||||
|
||||
// SetUserBlocked marks a blocked PID as blocked on a bloker PID block list
|
||||
func SetUserBlocked(blockerPID uint32, blockedPID uint32, titleId uint64, titleVersion uint16) error {
|
||||
date := nex.NewDateTime(0)
|
||||
date.FromTimestamp(time.Now())
|
||||
date := nex.NewDateTime(0).Now()
|
||||
|
||||
_, err := database.Postgres.Exec(`
|
||||
INSERT INTO wiiu.blocks (blocker_pid, blocked_pid, title_id, title_version, date)
|
||||
|
||||
Reference in New Issue
Block a user