-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Task] VX-233 johnlin/resource createdby #204
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #204 +/- ##
===========================================
+ Coverage 78.57% 78.57% +<.01%
===========================================
Files 59 60 +1
Lines 3300 3361 +61
===========================================
+ Hits 2593 2641 +48
- Misses 540 547 +7
- Partials 167 173 +6
Continue to review full report at Codecov.
|
39237b1
to
2ac5683
Compare
src/server/handler_network.go
Outdated
return | ||
} | ||
} | ||
network.CreatedBy = user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
一般是不是都存ID之類的,需要存到整個entity嗎?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
需要,這樣比較有效率 不用再多打一次 user api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
這樣如果user可以修改任何欄位的話,就會造成資訊不對等
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同時若有user被刪除,你從這邊不能知道他被刪除
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我們大部分操作都不會很大量的需求所以這邊的mongo lookuuup 應該沒太大的效能問題
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
user 不能修改id. 這個有跟前端討論過,主要是前端 query 的方式,多打一次user前端邏輯變得複雜
//init session | ||
suite.session = sp.Mongo.NewSession() | ||
//init restful container | ||
suite.wc = restful.NewContainer() | ||
service := newNetworkService(sp) | ||
suite.wc.Add(service) | ||
|
||
suite.sp = sp | ||
token, _ := loginGetToken(suite.sp, suite.wc) | ||
suite.JWTBearer = "Bearer " + token |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
空一格是故意的嗎?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
這是他的header規則
Authorization: Bearer <token>
src/server/main_test.go
Outdated
if v == 0 && failedDropTestDatabase() { | ||
os.Exit(1) | ||
} | ||
os.Exit(v) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
沒有處理v!=0時的db drop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我後來想一下 failedDropTestDatabase
都會跑到即使是 v!=0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
真怪,按照 short circult最佳化,應該前面false, 後面就不會跑了?
另外,如果testing都如預料以及預期,成功跑完不需要清空 mongo.因為 testing本身就要清除乾淨
01beba8
to
a7fc589
Compare
a7fc589
to
0d277c7
Compare
14f3b1a
to
3bfe35e
Compare
57f09d0
to
fe3b024
Compare
using for example db.users.insert({"_id":1,"username":"john"})
db.users.insert({"_id":2,"username":"john2"})
db.users.insert({"_id":3,"username":"yoyo"})
db.users.insert({"_id":4,"username":"yoyo2"})
db.networks.insert({"_id":1,"uid":3,"networkName":"yoyo-net"})
db.networks.insert({"_id":2,"uid":2,"networkName":"john-net2"})
db.networks.insert({"_id":3,"uid":1,"networkName":"john-net"})
db.networks.insert({"_id":4,"uid":4,"networkName":"yoyo-net2"})
db.networks.aggregate([
{
$lookup:
{
from: "users",
localField: "uid",
foreignField: "_id",
as: "users_docs"
}
}
])
db.networks.aggregate([
{
$lookup:
{
from: "users",
localField: "uid",
foreignField: "_id",
as: "users_docs"
}
},
{ $match : { _id : 3 } }
]) |
58a4825
to
1b5dca1
Compare
1b5dca1
to
e2dbc66
Compare
還剩下 deployment, app, namespace, storage, user 尚未做auth |
No description provided.