Skip to content

Commit 98c7f0e

Browse files
authored
Merge pull request #63 from codex-team/user-props
Add user project last visit and workspace membership types
2 parents c4454bc + dcd5434 commit 98c7f0e

11 files changed

Lines changed: 134 additions & 122 deletions

File tree

build/index.d.ts

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,34 @@
1-
export * from "./src/auth/tokensPair";
2-
export * from "./src/base/businessOperation/businessOperation";
3-
export * from "./src/billing/planProlongrationPayload";
4-
export * from "./src/base/event/affectedUser";
5-
export * from "./src/base/event/backtraceFrame";
6-
export * from "./src/base/event/breadcrumb";
7-
export * from "./src/base/event/event";
8-
export * from "./src/base/event/sourceCodeLine";
9-
export * from "./src/base/event/addons";
10-
export * from "./src/base/integrations/integrationToken";
11-
export * from "./src/dbScheme/businessOperation";
12-
export * from "./src/dbScheme/groupedEvent";
13-
export * from "./src/dbScheme/notificationsChannels";
14-
export * from "./src/dbScheme/notificationsChannelSettings";
15-
export * from "./src/dbScheme/membership";
16-
export * from "./src/dbScheme/plan";
17-
export * from "./src/dbScheme/project";
18-
export * from "./src/dbScheme/projectNotificationsRule";
19-
export * from "./src/dbScheme/release";
20-
export * from "./src/dbScheme/repetition";
21-
export * from "./src/dbScheme/sourceMap";
22-
export * from "./src/dbScheme/user";
23-
export * from "./src/dbScheme/userNotifications";
24-
export * from "./src/dbScheme/workspace";
25-
export * from "./src/dbScheme/bankCard";
26-
export * from "./src/dbScheme/sso";
27-
export * from "./src/dbScheme/projectEventGroupingPattern";
28-
export * from "./src/notifications/createProjectNotifications";
29-
export * from "./src/notifications/receiveTypes";
30-
export * from "./src/notifications/updateProjectNotifications";
31-
export * from "./src/notifications/userNotification";
32-
export * from "./src/catchers/catcher-message";
33-
export * from './src/utils';
1+
export type * from './src/auth/tokensPair';
2+
export type * from './src/base/businessOperation/businessOperation';
3+
export type * from './src/billing/planProlongrationPayload';
4+
export type * from './src/base/event/affectedUser';
5+
export type * from './src/base/event/backtraceFrame';
6+
export type * from './src/base/event/breadcrumb';
7+
export type * from './src/base/event/event';
8+
export type * from './src/base/event/sourceCodeLine';
9+
export type * from './src/base/event/addons';
10+
export type * from './src/base/integrations/integrationToken';
11+
export type * from './src/dbScheme/businessOperation';
12+
export type * from './src/dbScheme/groupedEvent';
13+
export type * from './src/dbScheme/notificationsChannels';
14+
export type * from './src/dbScheme/notificationsChannelSettings';
15+
export type * from './src/dbScheme/membership';
16+
export type * from './src/dbScheme/userProjectsLastVisit';
17+
export type * from './src/dbScheme/plan';
18+
export type * from './src/dbScheme/project';
19+
export type * from './src/dbScheme/projectNotificationsRule';
20+
export type * from './src/dbScheme/release';
21+
export type * from './src/dbScheme/repetition';
22+
export type * from './src/dbScheme/sourceMap';
23+
export type * from './src/dbScheme/user';
24+
export type * from './src/dbScheme/userNotifications';
25+
export type * from './src/dbScheme/workspace';
26+
export type * from './src/dbScheme/bankCard';
27+
export type * from './src/dbScheme/sso';
28+
export type * from './src/dbScheme/projectEventGroupingPattern';
29+
export type * from './src/notifications/createProjectNotifications';
30+
export type * from './src/notifications/receiveTypes';
31+
export type * from './src/notifications/updateProjectNotifications';
32+
export type * from './src/notifications/userNotification';
33+
export type * from './src/catchers/catcher-message';
34+
export type * from './src/utils';

build/index.js

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,2 @@
11
"use strict";
2-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3-
if (k2 === undefined) k2 = k;
4-
var desc = Object.getOwnPropertyDescriptor(m, k);
5-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6-
desc = { enumerable: true, get: function() { return m[k]; } };
7-
}
8-
Object.defineProperty(o, k2, desc);
9-
}) : (function(o, m, k, k2) {
10-
if (k2 === undefined) k2 = k;
11-
o[k2] = m[k];
12-
}));
13-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
14-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15-
};
162
Object.defineProperty(exports, "__esModule", { value: true });
17-
__exportStar(require("./src/auth/tokensPair"), exports);
18-
__exportStar(require("./src/base/businessOperation/businessOperation"), exports);
19-
__exportStar(require("./src/billing/planProlongrationPayload"), exports);
20-
__exportStar(require("./src/base/event/affectedUser"), exports);
21-
__exportStar(require("./src/base/event/backtraceFrame"), exports);
22-
__exportStar(require("./src/base/event/breadcrumb"), exports);
23-
__exportStar(require("./src/base/event/event"), exports);
24-
__exportStar(require("./src/base/event/sourceCodeLine"), exports);
25-
__exportStar(require("./src/base/event/addons"), exports);
26-
__exportStar(require("./src/base/integrations/integrationToken"), exports);
27-
__exportStar(require("./src/dbScheme/businessOperation"), exports);
28-
__exportStar(require("./src/dbScheme/groupedEvent"), exports);
29-
__exportStar(require("./src/dbScheme/notificationsChannels"), exports);
30-
__exportStar(require("./src/dbScheme/notificationsChannelSettings"), exports);
31-
__exportStar(require("./src/dbScheme/membership"), exports);
32-
__exportStar(require("./src/dbScheme/plan"), exports);
33-
__exportStar(require("./src/dbScheme/project"), exports);
34-
__exportStar(require("./src/dbScheme/projectNotificationsRule"), exports);
35-
__exportStar(require("./src/dbScheme/release"), exports);
36-
__exportStar(require("./src/dbScheme/repetition"), exports);
37-
__exportStar(require("./src/dbScheme/sourceMap"), exports);
38-
__exportStar(require("./src/dbScheme/user"), exports);
39-
__exportStar(require("./src/dbScheme/userNotifications"), exports);
40-
__exportStar(require("./src/dbScheme/workspace"), exports);
41-
__exportStar(require("./src/dbScheme/bankCard"), exports);
42-
__exportStar(require("./src/dbScheme/sso"), exports);
43-
__exportStar(require("./src/dbScheme/projectEventGroupingPattern"), exports);
44-
__exportStar(require("./src/notifications/createProjectNotifications"), exports);
45-
__exportStar(require("./src/notifications/receiveTypes"), exports);
46-
__exportStar(require("./src/notifications/updateProjectNotifications"), exports);
47-
__exportStar(require("./src/notifications/userNotification"), exports);
48-
__exportStar(require("./src/catchers/catcher-message"), exports);
49-
__exportStar(require("./src/utils"), exports);

build/src/dbScheme/membership.d.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,13 @@ export interface PendingMemberDBScheme {
3333
* Represents full structure of team collection documents
3434
*/
3535
export type MemberDBScheme = ConfirmedMemberDBScheme | PendingMemberDBScheme;
36+
/**
37+
* User workspace membership info stored in user document
38+
* Record of workspace IDs to membership data
39+
*/
40+
export type MembershipDBScheme = Record<string, {
41+
/**
42+
* Whether the user's membership is pending confirmation
43+
*/
44+
isPending?: boolean;
45+
}>;

build/src/dbScheme/user.d.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import type { ObjectId } from 'bson';
22
import type { UserNotificationsDBScheme } from '../../index.ts';
33
import type { BankCard } from './bankCard.ts';
4+
import type { MembershipDBScheme } from './membership.ts';
5+
import type { UserProjectsLastVisitDBScheme } from './userProjectsLastVisit.ts';
46
/**
57
* Interface representing how user is stored in DB
68
*/
@@ -29,6 +31,11 @@ export interface UserDBScheme {
2931
* User's GitHub profile id
3032
*/
3133
githubId?: string;
34+
/**
35+
* User's workspaces membership
36+
* Record of workspace IDs to membership data
37+
*/
38+
workspaces?: MembershipDBScheme;
3239
/**
3340
* User's original password (this field appears only after registration).
3441
* Using to send password to user after registration
@@ -38,6 +45,10 @@ export interface UserDBScheme {
3845
* User notifications settings
3946
*/
4047
notifications?: UserNotificationsDBScheme;
48+
/**
49+
* User's last visit timestamps for projects
50+
*/
51+
projectsLastVisit?: UserProjectsLastVisitDBScheme;
4152
/**
4253
* Saved bank cards for one-click payments
4354
*/
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/**
2+
* User's last visit timestamps for projects
3+
* Record of project IDs to Unix timestamps
4+
*/
5+
export type UserProjectsLastVisitDBScheme = Record<string, number>;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
"use strict";
2+
Object.defineProperty(exports, "__esModule", { value: true });

index.ts

Lines changed: 42 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,42 @@
1-
export * from "./src/auth/tokensPair";
2-
3-
export * from "./src/base/businessOperation/businessOperation";
4-
5-
export * from "./src/billing/planProlongrationPayload";
6-
7-
export * from "./src/base/event/affectedUser";
8-
export * from "./src/base/event/backtraceFrame";
9-
export * from "./src/base/event/breadcrumb";
10-
export * from "./src/base/event/event";
11-
export * from "./src/base/event/sourceCodeLine";
12-
export * from "./src/base/event/addons";
13-
14-
export * from "./src/base/integrations/integrationToken";
15-
16-
export * from "./src/dbScheme/businessOperation";
17-
export * from "./src/dbScheme/groupedEvent";
18-
export * from "./src/dbScheme/notificationsChannels";
19-
export * from "./src/dbScheme/notificationsChannelSettings";
20-
export * from "./src/dbScheme/membership";
21-
export * from "./src/dbScheme/plan";
22-
export * from "./src/dbScheme/project";
23-
export * from "./src/dbScheme/projectNotificationsRule";
24-
export * from "./src/dbScheme/release";
25-
export * from "./src/dbScheme/repetition";
26-
export * from "./src/dbScheme/sourceMap";
27-
export * from "./src/dbScheme/user";
28-
export * from "./src/dbScheme/userNotifications";
29-
export * from "./src/dbScheme/workspace";
30-
export * from "./src/dbScheme/bankCard";
31-
export * from "./src/dbScheme/sso";
32-
export * from "./src/dbScheme/projectEventGroupingPattern";
33-
34-
export * from "./src/notifications/createProjectNotifications";
35-
export * from "./src/notifications/receiveTypes";
36-
export * from "./src/notifications/updateProjectNotifications";
37-
export * from "./src/notifications/userNotification";
38-
39-
export * from "./src/catchers/catcher-message";
40-
41-
export * from './src/utils';
1+
export type * from './src/auth/tokensPair';
2+
3+
export type * from './src/base/businessOperation/businessOperation';
4+
5+
export type * from './src/billing/planProlongrationPayload';
6+
7+
export type * from './src/base/event/affectedUser';
8+
export type * from './src/base/event/backtraceFrame';
9+
export type * from './src/base/event/breadcrumb';
10+
export type * from './src/base/event/event';
11+
export type * from './src/base/event/sourceCodeLine';
12+
export type * from './src/base/event/addons';
13+
14+
export type * from './src/base/integrations/integrationToken';
15+
16+
export type * from './src/dbScheme/businessOperation';
17+
export type * from './src/dbScheme/groupedEvent';
18+
export type * from './src/dbScheme/notificationsChannels';
19+
export type * from './src/dbScheme/notificationsChannelSettings';
20+
export type * from './src/dbScheme/membership';
21+
export type * from './src/dbScheme/userProjectsLastVisit';
22+
export type * from './src/dbScheme/plan';
23+
export type * from './src/dbScheme/project';
24+
export type * from './src/dbScheme/projectNotificationsRule';
25+
export type * from './src/dbScheme/release';
26+
export type * from './src/dbScheme/repetition';
27+
export type * from './src/dbScheme/sourceMap';
28+
export type * from './src/dbScheme/user';
29+
export type * from './src/dbScheme/userNotifications';
30+
export type * from './src/dbScheme/workspace';
31+
export type * from './src/dbScheme/bankCard';
32+
export type * from './src/dbScheme/sso';
33+
export type * from './src/dbScheme/projectEventGroupingPattern';
34+
35+
export type * from './src/notifications/createProjectNotifications';
36+
export type * from './src/notifications/receiveTypes';
37+
export type * from './src/notifications/updateProjectNotifications';
38+
export type * from './src/notifications/userNotification';
39+
40+
export type * from './src/catchers/catcher-message';
41+
42+
export type * from './src/utils';

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hawk.so/types",
3-
"version": "0.4.0",
3+
"version": "0.4.1",
44
"description": "TypeScript definitions for Hawk",
55
"types": "build/index.d.ts",
66
"main": "build/index.js",

src/dbScheme/membership.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,14 @@ export interface PendingMemberDBScheme {
3939
* Represents full structure of team collection documents
4040
*/
4141
export type MemberDBScheme = ConfirmedMemberDBScheme | PendingMemberDBScheme;
42+
43+
/**
44+
* User workspace membership info stored in user document
45+
* Record of workspace IDs to membership data
46+
*/
47+
export type MembershipDBScheme = Record<string, {
48+
/**
49+
* Whether the user's membership is pending confirmation
50+
*/
51+
isPending?: boolean;
52+
}>;

src/dbScheme/user.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import type { ObjectId } from 'bson';
22
import type { UserNotificationsDBScheme } from '../../index.ts';
33
import type { BankCard } from './bankCard.ts';
4+
import type { MembershipDBScheme } from './membership.ts';
5+
import type { UserProjectsLastVisitDBScheme } from './userProjectsLastVisit.ts';
46

57
/**
68
* Interface representing how user is stored in DB
@@ -36,6 +38,12 @@ export interface UserDBScheme {
3638
*/
3739
githubId?: string;
3840

41+
/**
42+
* User's workspaces membership
43+
* Record of workspace IDs to membership data
44+
*/
45+
workspaces?: MembershipDBScheme;
46+
3947
/**
4048
* User's original password (this field appears only after registration).
4149
* Using to send password to user after registration
@@ -47,6 +55,11 @@ export interface UserDBScheme {
4755
*/
4856
notifications?: UserNotificationsDBScheme;
4957

58+
/**
59+
* User's last visit timestamps for projects
60+
*/
61+
projectsLastVisit?: UserProjectsLastVisitDBScheme;
62+
5063
/**
5164
* Saved bank cards for one-click payments
5265
*/

0 commit comments

Comments
 (0)