jp.db.schemas 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activity-log.repository.d.ts","sourceRoot":"","sources":["../../src/repositories/activity-log.repository.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAGjC,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,IAAI,CAAC;AAGtD,qBACa,qBAAqB;IAEK,OAAO,CAAC,gBAAgB;gBAAhB,gBAAgB,EAAE,KAAK,CAAC,mBAAmB,CAAC;IAIjF,mBAAmB,CACrB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,GACf,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"activity-log.repository.d.ts","sourceRoot":"","sources":["../../src/repositories/activity-log.repository.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAGjC,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,IAAI,CAAC;AAGtD,qBACa,qBAAqB;IAEK,OAAO,CAAC,gBAAgB;gBAAhB,gBAAgB,EAAE,KAAK,CAAC,mBAAmB,CAAC;IAIjF,mBAAmB,CACrB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,GACf,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IA6BxB,iBAAiB,CACnB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GAChB,OAAO,CAAC,WAAW,CAAC;IAWjB,qBAAqB,CACvB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACf,OAAO,CAAC,WAAW,CAAC;IAYjB,cAAc,CAAC,WAAW,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC;CAGhF"}
|
|
@@ -28,34 +28,28 @@ let ActivityLogRepository = class ActivityLogRepository {
|
|
|
28
28
|
}
|
|
29
29
|
async findLast7DaysLogins(game, userId) {
|
|
30
30
|
const weekAgo = (0, dayjs_1.default)().startOf('day').add(-1, 'week');
|
|
31
|
-
// return this.activityLogModel
|
|
32
|
-
// .find({
|
|
33
|
-
// game,
|
|
34
|
-
// userId,
|
|
35
|
-
// date: { $gte: weekAgo },
|
|
36
|
-
// })
|
|
37
|
-
// .exec();
|
|
38
31
|
return this.activityLogModel.aggregate([
|
|
39
32
|
{
|
|
40
33
|
$match: {
|
|
41
34
|
game,
|
|
42
35
|
userId,
|
|
43
|
-
date: { $gte: weekAgo },
|
|
36
|
+
date: { $gte: weekAgo.toDate() },
|
|
44
37
|
event: activity_log_enum_1.ActivityLogEnum.USER_LOGIN,
|
|
45
38
|
}
|
|
46
39
|
},
|
|
47
40
|
{
|
|
48
41
|
$group: {
|
|
49
|
-
_id: {
|
|
50
|
-
day: { $dayOfMonth: "$date" },
|
|
51
|
-
},
|
|
42
|
+
_id: { $dateToString: { format: "%Y-%m-%d", date: "$date" } },
|
|
52
43
|
userId: { $first: "$userId" },
|
|
53
44
|
userName: { $first: "$userName" },
|
|
54
|
-
date: { $first: "$date" },
|
|
55
45
|
event: { $first: "$event" },
|
|
56
46
|
game: { $first: "$game" },
|
|
57
47
|
channel: { $first: "$channel" },
|
|
48
|
+
count: { $sum: 1 },
|
|
58
49
|
}
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
$sort: { "_id": -1 }
|
|
59
53
|
}
|
|
60
54
|
]);
|
|
61
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activity-log.repository.js","sourceRoot":"","sources":["../../src/repositories/activity-log.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,+CAA+C;AAC/C,uCAAiC;AACjC,kDAA0B;AAE1B,0BAAsD;AACtD,mEAA8D;AAGvD,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAC9B,YAC2C,gBAA4C;QAA5C,qBAAgB,GAAhB,gBAAgB,CAA4B;IAEvF,CAAC;IAED,KAAK,CAAC,mBAAmB,CACrB,IAAY,EACZ,MAAc;QAEd,MAAM,OAAO,GAAG,IAAA,eAAK,GAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;QAEvD
|
|
1
|
+
{"version":3,"file":"activity-log.repository.js","sourceRoot":"","sources":["../../src/repositories/activity-log.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,+CAA+C;AAC/C,uCAAiC;AACjC,kDAA0B;AAE1B,0BAAsD;AACtD,mEAA8D;AAGvD,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAC9B,YAC2C,gBAA4C;QAA5C,qBAAgB,GAAhB,gBAAgB,CAA4B;IAEvF,CAAC;IAED,KAAK,CAAC,mBAAmB,CACrB,IAAY,EACZ,MAAc;QAEd,MAAM,OAAO,GAAG,IAAA,eAAK,GAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;QAEvD,OAAO,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC;YACnC;gBACI,MAAM,EAAE;oBACJ,IAAI;oBACJ,MAAM;oBACN,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,MAAM,EAAE,EAAE;oBAChC,KAAK,EAAE,mCAAe,CAAC,UAAU;iBACpC;aACJ;YACD;gBACI,MAAM,EAAE;oBACJ,GAAG,EAAE,EAAE,aAAa,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE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FzD,qBAAqB,CA2EjC"}
|
package/package.json
CHANGED
|
@@ -19,35 +19,28 @@ export class ActivityLogRepository {
|
|
|
19
19
|
): Promise<Array<ActivityLog>> {
|
|
20
20
|
const weekAgo = dayjs().startOf('day').add(-1, 'week');
|
|
21
21
|
|
|
22
|
-
// return this.activityLogModel
|
|
23
|
-
// .find({
|
|
24
|
-
// game,
|
|
25
|
-
// userId,
|
|
26
|
-
// date: { $gte: weekAgo },
|
|
27
|
-
// })
|
|
28
|
-
// .exec();
|
|
29
|
-
|
|
30
22
|
return this.activityLogModel.aggregate([
|
|
31
23
|
{
|
|
32
24
|
$match: {
|
|
33
25
|
game,
|
|
34
26
|
userId,
|
|
35
|
-
date: { $gte: weekAgo },
|
|
27
|
+
date: { $gte: weekAgo.toDate() },
|
|
36
28
|
event: ActivityLogEnum.USER_LOGIN,
|
|
37
29
|
}
|
|
38
30
|
},
|
|
39
31
|
{
|
|
40
32
|
$group: {
|
|
41
|
-
_id: {
|
|
42
|
-
day: { $dayOfMonth: "$date" },
|
|
43
|
-
},
|
|
33
|
+
_id: { $dateToString: { format: "%Y-%m-%d", date: "$date" } },
|
|
44
34
|
userId: { $first: "$userId" },
|
|
45
35
|
userName: { $first: "$userName" },
|
|
46
|
-
date: { $first: "$date" },
|
|
47
36
|
event: { $first: "$event" },
|
|
48
37
|
game: { $first: "$game" },
|
|
49
38
|
channel: { $first: "$channel" },
|
|
39
|
+
count: { $sum: 1 },
|
|
50
40
|
}
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
$sort: { "_id": -1 }
|
|
51
44
|
}
|
|
52
45
|
])
|
|
53
46
|
}
|