feat: update

This commit is contained in:
Rogee
2025-05-23 20:56:21 +08:00
parent 27bdcfb8bf
commit f836fcc726
2 changed files with 23 additions and 7 deletions

View File

@@ -3,10 +3,10 @@ package model
import ( import (
"context" "context"
"testing" "testing"
"time"
"quyun/app/service/testx" "quyun/app/service/testx"
"quyun/database" "quyun/database/fields"
"quyun/database/table"
. "github.com/smartystreets/goconvey/convey" . "github.com/smartystreets/goconvey/convey"
"go.ipao.vip/atom/contracts" "go.ipao.vip/atom/contracts"
@@ -36,8 +36,24 @@ func Test_Users(t *testing.T) {
}) })
} }
func (s *UsersTestSuite) Test_Demo() { func (s *UsersTestSuite) Test_Create() {
Convey("Test_Demo", s.T(), func() { Convey("Test_Create", s.T(), func() {
database.Truncate(context.Background(), db, table.Users.TableName()) user := &Users{
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
DeletedAt: nil,
Status: 1,
OpenID: "test_openid_123",
Username: "testuser",
Avatar: &[]string{"https://example.com/avatar.jpg"}[0],
Metas: fields.ToJson(fields.UserMetas{}),
AuthToken: fields.ToJson(fields.UserAuthToken{}),
Balance: 1000,
}
u, err := user.Create(context.TODO())
So(err, ShouldBeNil)
So(u, ShouldNotBeNil)
So(u.ID, ShouldNotBeZeroValue)
}) })
} }

View File

@@ -7,8 +7,8 @@ StoragePath = "/Users/rogee/Projects/self/quyun/fixtures"
Port = 8088 Port = 8088
[Database] [Database]
Host = "localhost" Host = "10.1.1.2"
Database = "postgres" Database = "quyun"
Password = "xixi0202" Password = "xixi0202"
[JWT] [JWT]