Skip to content

Commit c0aa149

Browse files
RangerMauveMauve Signweaver
andauthored
feat: Add collectStats field to project invites (#1098)
* feat: Add collectStats field to project invites * wip: Outline more of stats API * chore: rename collectStats to sendStats * feat: project. and initial test * chore: Pin specific schema version * chore: Check for sendStats in tests * test: make sure sendStats persists and is in invites * fix: rename sendStats in rpc.proto * fix: Add missing migration file * fix: sendStats should be required * chore: Fixes for sendStats being mandatory * chore: simplify stats shape, clean stats tests * chore: Optimize stats format to reduce blob size * chore: Use user timezone for project stats * chore: Use .values and number timezone offset * chore: Group stats by week * fix: Get current week for stats bucketing * test: Check stats bucketing with time mock * test: Skip stats bucket test on node 18 * tests: Replace nodejs timer mock with sinonjs fake-timers * chore: pull in package lock from main * chore: re-update package-lock --------- Co-authored-by: Mauve Signweaver <[email protected]>
1 parent 52460ba commit c0aa149

18 files changed

+527
-62
lines changed

drizzle/client/0003_neat_magus.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE projectSettings ADD `sendStats` integer NOT NULL DEFAULT 0;
Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
{
2+
"version": "5",
3+
"dialect": "sqlite",
4+
"id": "3b7b9e2d-3a35-47e3-977e-b5dcbe2fd302",
5+
"prevId": "facbbc92-fe5b-4ce0-9bcd-189143af55f9",
6+
"tables": {
7+
"deviceSettings": {
8+
"name": "deviceSettings",
9+
"columns": {
10+
"deviceId": {
11+
"name": "deviceId",
12+
"type": "text",
13+
"primaryKey": false,
14+
"notNull": true,
15+
"autoincrement": false
16+
},
17+
"deviceInfo": {
18+
"name": "deviceInfo",
19+
"type": "text",
20+
"primaryKey": false,
21+
"notNull": false,
22+
"autoincrement": false
23+
},
24+
"isArchiveDevice": {
25+
"name": "isArchiveDevice",
26+
"type": "integer",
27+
"primaryKey": false,
28+
"notNull": false,
29+
"autoincrement": false
30+
}
31+
},
32+
"indexes": {
33+
"deviceSettings_deviceId_unique": {
34+
"name": "deviceSettings_deviceId_unique",
35+
"columns": [
36+
"deviceId"
37+
],
38+
"isUnique": true
39+
}
40+
},
41+
"foreignKeys": {},
42+
"compositePrimaryKeys": {},
43+
"uniqueConstraints": {}
44+
},
45+
"projectSettings_backlink": {
46+
"name": "projectSettings_backlink",
47+
"columns": {
48+
"versionId": {
49+
"name": "versionId",
50+
"type": "text",
51+
"primaryKey": true,
52+
"notNull": true,
53+
"autoincrement": false
54+
}
55+
},
56+
"indexes": {},
57+
"foreignKeys": {},
58+
"compositePrimaryKeys": {},
59+
"uniqueConstraints": {}
60+
},
61+
"projectKeys": {
62+
"name": "projectKeys",
63+
"columns": {
64+
"projectId": {
65+
"name": "projectId",
66+
"type": "text",
67+
"primaryKey": true,
68+
"notNull": true,
69+
"autoincrement": false
70+
},
71+
"projectPublicId": {
72+
"name": "projectPublicId",
73+
"type": "text",
74+
"primaryKey": false,
75+
"notNull": true,
76+
"autoincrement": false
77+
},
78+
"projectInviteId": {
79+
"name": "projectInviteId",
80+
"type": "blob",
81+
"primaryKey": false,
82+
"notNull": true,
83+
"autoincrement": false
84+
},
85+
"keysCipher": {
86+
"name": "keysCipher",
87+
"type": "blob",
88+
"primaryKey": false,
89+
"notNull": true,
90+
"autoincrement": false
91+
},
92+
"projectInfo": {
93+
"name": "projectInfo",
94+
"type": "text",
95+
"primaryKey": false,
96+
"notNull": true,
97+
"autoincrement": false,
98+
"default": "'{}'"
99+
}
100+
},
101+
"indexes": {},
102+
"foreignKeys": {},
103+
"compositePrimaryKeys": {},
104+
"uniqueConstraints": {}
105+
},
106+
"projectSettings": {
107+
"name": "projectSettings",
108+
"columns": {
109+
"docId": {
110+
"name": "docId",
111+
"type": "text",
112+
"primaryKey": true,
113+
"notNull": true,
114+
"autoincrement": false
115+
},
116+
"versionId": {
117+
"name": "versionId",
118+
"type": "text",
119+
"primaryKey": false,
120+
"notNull": true,
121+
"autoincrement": false
122+
},
123+
"originalVersionId": {
124+
"name": "originalVersionId",
125+
"type": "text",
126+
"primaryKey": false,
127+
"notNull": true,
128+
"autoincrement": false
129+
},
130+
"schemaName": {
131+
"name": "schemaName",
132+
"type": "text",
133+
"primaryKey": false,
134+
"notNull": true,
135+
"autoincrement": false
136+
},
137+
"createdAt": {
138+
"name": "createdAt",
139+
"type": "text",
140+
"primaryKey": false,
141+
"notNull": true,
142+
"autoincrement": false
143+
},
144+
"updatedAt": {
145+
"name": "updatedAt",
146+
"type": "text",
147+
"primaryKey": false,
148+
"notNull": true,
149+
"autoincrement": false
150+
},
151+
"links": {
152+
"name": "links",
153+
"type": "text",
154+
"primaryKey": false,
155+
"notNull": true,
156+
"autoincrement": false
157+
},
158+
"deleted": {
159+
"name": "deleted",
160+
"type": "integer",
161+
"primaryKey": false,
162+
"notNull": true,
163+
"autoincrement": false
164+
},
165+
"name": {
166+
"name": "name",
167+
"type": "text",
168+
"primaryKey": false,
169+
"notNull": false,
170+
"autoincrement": false
171+
},
172+
"projectDescription": {
173+
"name": "projectDescription",
174+
"type": "text",
175+
"primaryKey": false,
176+
"notNull": false,
177+
"autoincrement": false
178+
},
179+
"projectColor": {
180+
"name": "projectColor",
181+
"type": "text",
182+
"primaryKey": false,
183+
"notNull": false,
184+
"autoincrement": false
185+
},
186+
"sendStats": {
187+
"name": "sendStats",
188+
"type": "integer",
189+
"primaryKey": false,
190+
"notNull": true,
191+
"autoincrement": false
192+
},
193+
"defaultPresets": {
194+
"name": "defaultPresets",
195+
"type": "text",
196+
"primaryKey": false,
197+
"notNull": false,
198+
"autoincrement": false
199+
},
200+
"configMetadata": {
201+
"name": "configMetadata",
202+
"type": "text",
203+
"primaryKey": false,
204+
"notNull": false,
205+
"autoincrement": false
206+
},
207+
"forks": {
208+
"name": "forks",
209+
"type": "text",
210+
"primaryKey": false,
211+
"notNull": true,
212+
"autoincrement": false
213+
}
214+
},
215+
"indexes": {},
216+
"foreignKeys": {},
217+
"compositePrimaryKeys": {},
218+
"uniqueConstraints": {}
219+
}
220+
},
221+
"enums": {},
222+
"_meta": {
223+
"schemas": {},
224+
"tables": {},
225+
"columns": {}
226+
}
227+
}

drizzle/client/meta/_journal.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@
2222
"when": 1744822575870,
2323
"tag": "0002_brief_demogoblin",
2424
"breakpoints": true
25+
},
26+
{
27+
"idx": 3,
28+
"version": "5",
29+
"when": 1756331824879,
30+
"tag": "0003_neat_magus",
31+
"breakpoints": true
2532
}
2633
]
2734
}

package-lock.json

Lines changed: 18 additions & 52 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162
},
163163
"dependencies": {
164164
"@comapeo/fallback-smp": "^1.0.0",
165-
"@comapeo/schema": "2.0.0",
165+
"@comapeo/schema": "^2.1.1",
166166
"@digidem/types": "^2.3.0",
167167
"@fastify/error": "^3.4.1",
168168
"@fastify/type-provider-typebox": "^4.1.0",

proto/rpc.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ message Invite {
1111
string invitorName = 6;
1212
optional string projectColor = 7;
1313
optional string projectDescription = 8;
14+
bool sendStats = 9;
1415
}
1516

1617
message InviteCancel {

src/generated/rpc.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export interface Invite {
99
invitorName: string;
1010
projectColor?: string | undefined;
1111
projectDescription?: string | undefined;
12+
sendStats: boolean;
1213
}
1314
export interface InviteCancel {
1415
inviteId: Buffer;

0 commit comments

Comments
 (0)