@sneat/dto 0.1.2 → 0.1.4
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.
- package/esm2022/index.js +2 -0
- package/esm2022/index.js.map +1 -0
- package/esm2022/lib/by-user.js +2 -0
- package/esm2022/lib/by-user.js.map +1 -0
- package/esm2022/lib/dto-app.js +2 -0
- package/esm2022/lib/dto-app.js.map +1 -0
- package/esm2022/lib/dto-brief.js +2 -0
- package/esm2022/lib/dto-brief.js.map +1 -0
- package/esm2022/lib/dto-commune.js +89 -0
- package/esm2022/lib/dto-commune.js.map +1 -0
- package/{src/lib/dto-constants.ts → esm2022/lib/dto-constants.js} +1 -0
- package/esm2022/lib/dto-constants.js.map +1 -0
- package/esm2022/lib/dto-models.js +23 -0
- package/esm2022/lib/dto-models.js.map +1 -0
- package/esm2022/lib/dto-pricing.js +2 -0
- package/esm2022/lib/dto-pricing.js.map +1 -0
- package/esm2022/lib/dto-team-brief.js +9 -0
- package/esm2022/lib/dto-team-brief.js.map +1 -0
- package/esm2022/lib/dto-team-info.js +4 -0
- package/esm2022/lib/dto-team-info.js.map +1 -0
- package/esm2022/lib/dto-team-meeting.js +2 -0
- package/esm2022/lib/dto-team-meeting.js.map +1 -0
- package/esm2022/lib/dto-team-metric.js +2 -0
- package/esm2022/lib/dto-team-metric.js.map +1 -0
- package/esm2022/lib/dto-team.js +2 -0
- package/esm2022/lib/dto-team.js.map +1 -0
- package/esm2022/lib/dto-user.js +33 -0
- package/esm2022/lib/dto-user.js.map +1 -0
- package/esm2022/lib/dto-with-modified.js +2 -0
- package/esm2022/lib/dto-with-modified.js.map +1 -0
- package/esm2022/lib/index.js +19 -0
- package/esm2022/lib/index.js.map +1 -0
- package/esm2022/lib/period.js +2 -0
- package/esm2022/lib/period.js.map +1 -0
- package/esm2022/lib/types.js +2 -0
- package/esm2022/lib/types.js.map +1 -0
- package/esm2022/lib/ui-state.js +2 -0
- package/esm2022/lib/ui-state.js.map +1 -0
- package/esm2022/lib/with-related.js +94 -0
- package/esm2022/lib/with-related.js.map +1 -0
- package/esm2022/sneat-dto.js +5 -0
- package/esm2022/sneat-dto.js.map +1 -0
- package/lib/by-user.d.ts +4 -0
- package/lib/dto-app.d.ts +6 -0
- package/{src/lib/dto-brief.ts → lib/dto-brief.d.ts} +2 -2
- package/lib/dto-commune.d.ts +53 -0
- package/lib/dto-constants.d.ts +2 -0
- package/lib/dto-models.d.ts +59 -0
- package/lib/dto-pricing.d.ts +5 -0
- package/lib/dto-team-brief.d.ts +9 -0
- package/lib/dto-team-info.d.ts +8 -0
- package/lib/dto-team-meeting.d.ts +6 -0
- package/lib/dto-team-metric.d.ts +20 -0
- package/lib/dto-team.d.ts +12 -0
- package/lib/dto-user.d.ts +31 -0
- package/lib/dto-with-modified.d.ts +26 -0
- package/lib/types.d.ts +7 -0
- package/lib/ui-state.d.ts +5 -0
- package/lib/with-related.d.ts +42 -0
- package/package.json +14 -2
- package/sneat-dto.d.ts +5 -0
- package/eslint.config.js +0 -7
- package/ng-package.json +0 -7
- package/project.json +0 -38
- package/src/lib/by-user.ts +0 -4
- package/src/lib/dto-app.ts +0 -9
- package/src/lib/dto-commune.ts +0 -158
- package/src/lib/dto-constants.spec.ts +0 -7
- package/src/lib/dto-models.ts +0 -105
- package/src/lib/dto-pricing.ts +0 -5
- package/src/lib/dto-team-brief.ts +0 -20
- package/src/lib/dto-team-info.ts +0 -15
- package/src/lib/dto-team-meeting.ts +0 -6
- package/src/lib/dto-team-metric.ts +0 -29
- package/src/lib/dto-team.ts +0 -27
- package/src/lib/dto-user.ts +0 -85
- package/src/lib/dto-with-modified.ts +0 -32
- package/src/lib/types.ts +0 -34
- package/src/lib/ui-state.ts +0 -5
- package/src/lib/with-related.ts +0 -180
- package/src/test-setup.ts +0 -1
- package/tsconfig.json +0 -13
- package/tsconfig.lib.json +0 -19
- package/tsconfig.lib.prod.json +0 -7
- package/tsconfig.spec.json +0 -31
- package/vite.config.mts +0 -10
- /package/{src/index.ts → index.d.ts} +0 -0
- /package/{src/lib/index.ts → lib/index.d.ts} +0 -0
- /package/{src/lib/period.ts → lib/period.d.ts} +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SpaceType } from '@sneat/core';
|
|
2
|
+
export interface ISpaceBrief {
|
|
3
|
+
readonly title: string;
|
|
4
|
+
readonly type: SpaceType;
|
|
5
|
+
readonly parentSpaceID?: string;
|
|
6
|
+
readonly roles?: string[];
|
|
7
|
+
}
|
|
8
|
+
export declare const equalSpaceBriefs: (v1?: ISpaceBrief | null | undefined, v2?: ISpaceBrief | null | undefined) => boolean;
|
|
9
|
+
export declare const isSpaceSupportsMemberGroups: (t: SpaceType) => boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SpaceType } from '@sneat/core';
|
|
2
|
+
import { IUserCommuneInfo } from './dto-user';
|
|
3
|
+
export interface IShortSpaceInfo {
|
|
4
|
+
type: SpaceType;
|
|
5
|
+
id?: string;
|
|
6
|
+
title?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function createShortCommuneInfoFromUserCommuneInfo(v: IUserCommuneInfo): IShortSpaceInfo;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type MetricColor = 'primary' | 'secondary' | 'tertiary' | 'success' | 'danger' | 'warning';
|
|
2
|
+
export interface IBoolMetricVal {
|
|
3
|
+
label: string;
|
|
4
|
+
color: MetricColor;
|
|
5
|
+
}
|
|
6
|
+
export interface IBoolMetric {
|
|
7
|
+
true: IBoolMetricVal;
|
|
8
|
+
false: IBoolMetricVal;
|
|
9
|
+
}
|
|
10
|
+
export interface ISpaceMetric {
|
|
11
|
+
id?: string;
|
|
12
|
+
title: string;
|
|
13
|
+
colorTrue?: MetricColor;
|
|
14
|
+
colorFalse?: MetricColor;
|
|
15
|
+
type: 'bool' | 'integer' | 'options';
|
|
16
|
+
mode: 'personal' | 'team';
|
|
17
|
+
bool?: IBoolMetric;
|
|
18
|
+
min?: number;
|
|
19
|
+
max?: number;
|
|
20
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ITotalsHolder } from './dto-models';
|
|
2
|
+
import { ISpaceBrief } from './dto-team-brief';
|
|
3
|
+
import { ISpaceMetric } from './dto-team-metric';
|
|
4
|
+
export interface ISpaceDbo extends ISpaceBrief, ITotalsHolder {
|
|
5
|
+
readonly countryID: string;
|
|
6
|
+
readonly userIDs: string[];
|
|
7
|
+
metrics: ISpaceMetric[];
|
|
8
|
+
upcomingRetro?: {
|
|
9
|
+
itemsByUserAndType?: Record<string, Record<string, number>>;
|
|
10
|
+
};
|
|
11
|
+
noContactRoles?: string[];
|
|
12
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ITitledRecord } from './dto-models';
|
|
2
|
+
import { ICommuneDbo } from './dto-commune';
|
|
3
|
+
import { CommuneType, CountryId } from './types';
|
|
4
|
+
export interface IUserCommuneInfo {
|
|
5
|
+
id?: string;
|
|
6
|
+
shortId?: string;
|
|
7
|
+
title?: string;
|
|
8
|
+
type: CommuneType;
|
|
9
|
+
}
|
|
10
|
+
export declare function createUserCommuneInfoFromCommuneDto(communeDto: ICommuneDbo, shortId?: string): IUserCommuneInfo;
|
|
11
|
+
export interface IUserDbo extends ITitledRecord {
|
|
12
|
+
countryIds?: CountryId[];
|
|
13
|
+
created: {
|
|
14
|
+
hostOrApp: string;
|
|
15
|
+
at: string;
|
|
16
|
+
};
|
|
17
|
+
readonly communes?: readonly IUserCommuneInfo[];
|
|
18
|
+
communesCount?: number;
|
|
19
|
+
isAnonymous: boolean;
|
|
20
|
+
isDemo?: boolean;
|
|
21
|
+
autogeneratedPassword?: string;
|
|
22
|
+
emailVerified?: boolean;
|
|
23
|
+
email?: string;
|
|
24
|
+
emailOriginal?: string;
|
|
25
|
+
gender?: 'male' | 'female' | 'undisclosed';
|
|
26
|
+
}
|
|
27
|
+
export declare function addCommuneToUserDto(userDto: IUserDbo, communeInfo: IUserCommuneInfo): IUserDbo;
|
|
28
|
+
export declare class UserModel {
|
|
29
|
+
static getCommuneInfoByShortId(id: string, communes?: readonly IUserCommuneInfo[]): IUserCommuneInfo | undefined;
|
|
30
|
+
static getCommuneInfoById(id: string, communes: readonly IUserCommuneInfo[]): IUserCommuneInfo | undefined;
|
|
31
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface timestamp {
|
|
2
|
+
seconds: number;
|
|
3
|
+
nanoseconds: number;
|
|
4
|
+
}
|
|
5
|
+
export declare const emptyTimestamp: timestamp;
|
|
6
|
+
export interface IWithCreatedShort {
|
|
7
|
+
readonly at: string;
|
|
8
|
+
readonly by: string;
|
|
9
|
+
}
|
|
10
|
+
export interface IWithCreatedOn {
|
|
11
|
+
readonly createdOn: string;
|
|
12
|
+
}
|
|
13
|
+
export interface IWithCreated {
|
|
14
|
+
readonly createdAt: timestamp;
|
|
15
|
+
readonly createdBy: string;
|
|
16
|
+
}
|
|
17
|
+
export interface IWithUpdated {
|
|
18
|
+
readonly updatedAt: timestamp;
|
|
19
|
+
readonly updatedBy: string;
|
|
20
|
+
}
|
|
21
|
+
export interface IWithDeleted {
|
|
22
|
+
readonly deletedAt?: timestamp;
|
|
23
|
+
readonly deletedBy?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface IWithModified extends IWithCreated, IWithUpdated, IWithDeleted {
|
|
26
|
+
}
|
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SpaceType } from '@sneat/core';
|
|
2
|
+
export { SpaceMemberType } from '@sneat/auth-models';
|
|
3
|
+
export type Restriction = 'adults_only' | 'personal' | string;
|
|
4
|
+
export type SneatRecordStatus = 'active' | 'archived' | 'deleted';
|
|
5
|
+
export type CommuneType = SpaceType;
|
|
6
|
+
export type CountryId = 'IE' | 'US' | 'UK' | 'RU' | 'FR' | 'ES' | 'AU' | 'ZA' | string;
|
|
7
|
+
export type CommuneItemCounter = 'activities' | 'assets' | 'assetGroups' | 'contacts' | 'documents' | 'liabilities' | 'members' | 'memberGroups' | 'overdues' | 'regularTasks' | 'todos' | 'upcomings';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { IWithCreatedShort } from './dto-with-modified';
|
|
2
|
+
export interface IRelatedItemKey {
|
|
3
|
+
readonly itemID: string;
|
|
4
|
+
readonly spaceID?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ISpaceModuleItemRef {
|
|
7
|
+
readonly module: string;
|
|
8
|
+
readonly collection: string;
|
|
9
|
+
readonly spaceID: string;
|
|
10
|
+
readonly itemID: string;
|
|
11
|
+
}
|
|
12
|
+
export interface IRelationshipRole {
|
|
13
|
+
readonly created: IWithCreatedShort;
|
|
14
|
+
}
|
|
15
|
+
export type WritableRelationshipRoles = Record<string, IRelationshipRole>;
|
|
16
|
+
export type IRelationshipRoles = Readonly<WritableRelationshipRoles>;
|
|
17
|
+
export interface IRelatedItem {
|
|
18
|
+
readonly rolesOfItem?: IRelationshipRoles;
|
|
19
|
+
readonly rolesToItem?: IRelationshipRoles;
|
|
20
|
+
}
|
|
21
|
+
export type IRelatedItems = Readonly<Record<string, IRelatedItem>>;
|
|
22
|
+
export type IRelatedCollections = Readonly<Record<string, IRelatedItems>>;
|
|
23
|
+
export type IRelatedModules = Readonly<Record<string, IRelatedCollections>>;
|
|
24
|
+
export interface IRelatedTo extends IWithRelatedOnly {
|
|
25
|
+
readonly key: ISpaceModuleItemRef;
|
|
26
|
+
readonly title: string;
|
|
27
|
+
}
|
|
28
|
+
export declare function getRelatedItems(moduleId: string, collectionId: string, related?: IRelatedModules): IRelatedItems;
|
|
29
|
+
export interface IWithRelatedOnly {
|
|
30
|
+
readonly related?: IRelatedModules;
|
|
31
|
+
}
|
|
32
|
+
export declare function validateRelated(related?: IRelatedModules): void;
|
|
33
|
+
export interface IWithRelatedAndRelatedIDs extends IWithRelatedOnly {
|
|
34
|
+
readonly relatedIDs?: readonly string[];
|
|
35
|
+
}
|
|
36
|
+
export declare const addRelatedItem: (related: IRelatedModules | undefined, key: ISpaceModuleItemRef, rolesOfItem?: IRelationshipRoles) => Readonly<Record<string, Readonly<Record<string, Readonly<Record<string, IRelatedItem>>>>>>;
|
|
37
|
+
export declare const removeRelatedItem: (related: IRelatedModules | undefined, key: ISpaceModuleItemRef) => Readonly<Record<string, Readonly<Record<string, Readonly<Record<string, IRelatedItem>>>>>> | undefined;
|
|
38
|
+
export declare const getLongRelatedItemID: (itemID: string, spaceID: string) => string;
|
|
39
|
+
export declare const getRelatedItemByIDs: (relatedItems: Readonly<Record<string, IRelatedItem>> | undefined, itemID: string, spaceID?: string) => IRelatedItem | undefined;
|
|
40
|
+
export declare const getRelatedItemByKey: (related: IRelatedModules | undefined, key: ISpaceModuleItemRef) => IRelatedItem | undefined;
|
|
41
|
+
export declare const getRelatedItemIDs: (related: IRelatedModules | undefined, module: string, collection: string, spaceID?: string) => readonly string[];
|
|
42
|
+
export declare const hasRelated: (related: IRelatedModules | undefined, key: ISpaceModuleItemRef) => boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sneat/dto",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -10,5 +10,17 @@
|
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"tslib": "2.8.1"
|
|
13
|
-
}
|
|
13
|
+
},
|
|
14
|
+
"module": "esm2022/sneat-dto.js",
|
|
15
|
+
"typings": "sneat-dto.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
"./package.json": {
|
|
18
|
+
"default": "./package.json"
|
|
19
|
+
},
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./sneat-dto.d.ts",
|
|
22
|
+
"default": "./esm2022/sneat-dto.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"sideEffects": false
|
|
14
26
|
}
|
package/sneat-dto.d.ts
ADDED
package/eslint.config.js
DELETED
package/ng-package.json
DELETED
package/project.json
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "dto",
|
|
3
|
-
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
-
"projectType": "library",
|
|
5
|
-
"sourceRoot": "libs/dto/src",
|
|
6
|
-
"prefix": "sneat",
|
|
7
|
-
"targets": {
|
|
8
|
-
"build": {
|
|
9
|
-
"executor": "@nx/angular:ng-packagr-lite",
|
|
10
|
-
"outputs": [
|
|
11
|
-
"{workspaceRoot}/dist/libs/dto"
|
|
12
|
-
],
|
|
13
|
-
"options": {
|
|
14
|
-
"project": "libs/dto/ng-package.json",
|
|
15
|
-
"tsConfig": "libs/dto/tsconfig.lib.json"
|
|
16
|
-
},
|
|
17
|
-
"configurations": {
|
|
18
|
-
"production": {
|
|
19
|
-
"tsConfig": "libs/dto/tsconfig.lib.prod.json"
|
|
20
|
-
},
|
|
21
|
-
"development": {}
|
|
22
|
-
},
|
|
23
|
-
"defaultConfiguration": "production"
|
|
24
|
-
},
|
|
25
|
-
"test": {
|
|
26
|
-
"executor": "@nx/vitest:test",
|
|
27
|
-
"outputs": [
|
|
28
|
-
"{workspaceRoot}/coverage/libs/dto"
|
|
29
|
-
],
|
|
30
|
-
"options": {
|
|
31
|
-
"tsConfig": "libs/dto/tsconfig.spec.json"
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
"lint": {
|
|
35
|
-
"executor": "@nx/eslint:lint"
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
package/src/lib/by-user.ts
DELETED
package/src/lib/dto-app.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// import { IAuthStateRecord } from '../../auth/interfaces';
|
|
2
|
-
import { ITitledRecord } from './dto-models';
|
|
3
|
-
|
|
4
|
-
export interface DtoApp {
|
|
5
|
-
/*extends IRecord*/ users?: ITitledRecord[];
|
|
6
|
-
currentLanguage?: string;
|
|
7
|
-
// authState?: IAuthStateRecord;
|
|
8
|
-
isInDemoMode?: boolean;
|
|
9
|
-
}
|
package/src/lib/dto-commune.ts
DELETED
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import { IDemoRecord, ITitledRecord, ITotalsHolder } from './dto-models';
|
|
2
|
-
import { CommuneType, CountryId } from './types';
|
|
3
|
-
|
|
4
|
-
export const enum SpaceCounter {
|
|
5
|
-
activities = 'activities',
|
|
6
|
-
assets = 'assets',
|
|
7
|
-
assetGroups = 'assetGroups',
|
|
8
|
-
contacts = 'contacts',
|
|
9
|
-
documents = 'documents',
|
|
10
|
-
liabilities = 'liabilities',
|
|
11
|
-
members = 'members',
|
|
12
|
-
// membersByRole = 'membersByRole',
|
|
13
|
-
memberGroups = 'memberGroups',
|
|
14
|
-
overdues = 'overdues',
|
|
15
|
-
pupils = 'pupils',
|
|
16
|
-
regularTasks = 'regularTasks',
|
|
17
|
-
staff = 'staff',
|
|
18
|
-
todos = 'todos',
|
|
19
|
-
upcomings = 'upcomings',
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// type TeamCounters = {
|
|
23
|
-
// [P in EnumAsUnionOfKeys<typeof TeamCounter>]: number;
|
|
24
|
-
// };
|
|
25
|
-
|
|
26
|
-
export interface SpaceCounts {
|
|
27
|
-
[SpaceCounter.activities]?: number;
|
|
28
|
-
[SpaceCounter.assets]?: number;
|
|
29
|
-
[SpaceCounter.assetGroups]?: number;
|
|
30
|
-
[SpaceCounter.contacts]?: number;
|
|
31
|
-
[SpaceCounter.documents]?: number;
|
|
32
|
-
[SpaceCounter.regularTasks]?: number;
|
|
33
|
-
[SpaceCounter.liabilities]?: number;
|
|
34
|
-
[SpaceCounter.pupils]?: number;
|
|
35
|
-
[SpaceCounter.staff]?: number;
|
|
36
|
-
[SpaceCounter.members]?: number;
|
|
37
|
-
[SpaceCounter.memberGroups]?: number;
|
|
38
|
-
[SpaceCounter.overdues]?: number;
|
|
39
|
-
[SpaceCounter.todos]?: number;
|
|
40
|
-
[SpaceCounter.upcomings]?: number;
|
|
41
|
-
// [CommuneCounter.membersByRole]?: { [role: string]: number }; this does not make sense here
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export function incrementNumberOf<
|
|
45
|
-
NumberOf,
|
|
46
|
-
Dbo extends { numberOf?: NumberOf },
|
|
47
|
-
>(dto: Dbo, init: () => NumberOf, counter: keyof NumberOf, v = 1): Dbo {
|
|
48
|
-
const current: number = ((dto.numberOf && dto.numberOf[counter]) ||
|
|
49
|
-
0) as unknown as number;
|
|
50
|
-
return {
|
|
51
|
-
...dto,
|
|
52
|
-
numberOf: {
|
|
53
|
-
...(dto.numberOf || init()),
|
|
54
|
-
[counter]: current + v,
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export function newSpaceCounts(numberOf?: SpaceCounts): SpaceCounts {
|
|
60
|
-
numberOf = numberOf || {};
|
|
61
|
-
return {
|
|
62
|
-
activities: numberOf.activities || 0,
|
|
63
|
-
assets: numberOf.assets || 0,
|
|
64
|
-
assetGroups: numberOf.assetGroups || 0,
|
|
65
|
-
contacts: numberOf.contacts || 0,
|
|
66
|
-
documents: numberOf.documents || 0,
|
|
67
|
-
members: numberOf.members || 0,
|
|
68
|
-
memberGroups: numberOf.memberGroups || 0,
|
|
69
|
-
liabilities: numberOf.liabilities || 0,
|
|
70
|
-
overdues: numberOf.overdues || 0,
|
|
71
|
-
regularTasks: numberOf.regularTasks || 0,
|
|
72
|
-
todos: numberOf.todos || 0,
|
|
73
|
-
upcomings: numberOf.upcomings || 0,
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export interface ICommuneDbo extends IDemoRecord, ITitledRecord, ITotalsHolder {
|
|
78
|
-
readonly countryId?: CountryId;
|
|
79
|
-
readonly type: CommuneType;
|
|
80
|
-
readonly desc?: string;
|
|
81
|
-
readonly userID: string;
|
|
82
|
-
readonly order?: number;
|
|
83
|
-
readonly numberOf?: SpaceCounts;
|
|
84
|
-
readonly membersCountByRole?: Record<string, number>;
|
|
85
|
-
readonly noContactRoles?: string[];
|
|
86
|
-
// readonly groups?: ICommuneDtoMemberGroupInfo[];
|
|
87
|
-
// readonly members?: readonly ITeamMemberInfo[];
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export function isCommuneShouldHoldMembersInfo(type: CommuneType): boolean {
|
|
91
|
-
return type === 'family' || type === 'cohabit';
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// export function findCommuneMemberInfo(
|
|
95
|
-
// members: readonly ITeamMemberInfo[],
|
|
96
|
-
// member: { readonly id?: string; readonly userID?: string },
|
|
97
|
-
// ): ITeamMemberInfo | undefined {
|
|
98
|
-
// return (
|
|
99
|
-
// members &&
|
|
100
|
-
// members.find(
|
|
101
|
-
// (m) =>
|
|
102
|
-
// (m && !!m.id && m.id === member.id) ||
|
|
103
|
-
// (!!m.userID && m.userID === member.userID),
|
|
104
|
-
// )
|
|
105
|
-
// );
|
|
106
|
-
// }
|
|
107
|
-
|
|
108
|
-
export const personalCommuneIdPrefix = 'u_';
|
|
109
|
-
|
|
110
|
-
export function getUserPersonalCommuneID(userID?: string): string {
|
|
111
|
-
if (!userID) {
|
|
112
|
-
throw new Error('userID is required parameter');
|
|
113
|
-
}
|
|
114
|
-
return personalCommuneIdPrefix + userID;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export function isPersonalCommuneId(id: string): boolean {
|
|
118
|
-
return !!id && id.startsWith(personalCommuneIdPrefix);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export function isUserPersonalCommune(
|
|
122
|
-
communeID: string,
|
|
123
|
-
userID?: string,
|
|
124
|
-
): boolean {
|
|
125
|
-
return !!userID && communeID === getUserPersonalCommuneID(userID);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// export const CommuneModel = {
|
|
129
|
-
// getListInfoByRealId: (dto: ITeamDto, listId: string) => {
|
|
130
|
-
// const result =
|
|
131
|
-
// dto.listGroups &&
|
|
132
|
-
// dto.listGroups
|
|
133
|
-
// .map((lg) => lg.lists && lg.lists.find((l) => l.id === listId))
|
|
134
|
-
// .find((l) => !!l);
|
|
135
|
-
// console.log(
|
|
136
|
-
// `CommuneModel.getListInfoByRealId(${listId})`,
|
|
137
|
-
// dto.listGroups,
|
|
138
|
-
// ' => ',
|
|
139
|
-
// result,
|
|
140
|
-
// );
|
|
141
|
-
// return result;
|
|
142
|
-
// },
|
|
143
|
-
//
|
|
144
|
-
// getListInfoByShortId: (dto: ICommuneDto, shortListId: string) => {
|
|
145
|
-
// console.log(
|
|
146
|
-
// `CommuneModel.getListInfoByShortId(${shortListId})`,
|
|
147
|
-
// dto.listGroups,
|
|
148
|
-
// );
|
|
149
|
-
// return (
|
|
150
|
-
// dto.listGroups &&
|
|
151
|
-
// dto.listGroups
|
|
152
|
-
// .map(
|
|
153
|
-
// (lg) => lg.lists && lg.lists.find((l) => l.shortId === shortListId),
|
|
154
|
-
// )
|
|
155
|
-
// .find((l) => !!l)
|
|
156
|
-
// );
|
|
157
|
-
// },
|
|
158
|
-
// };
|
package/src/lib/dto-models.ts
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { Restriction } from './types';
|
|
2
|
-
|
|
3
|
-
// import {IPersonSize} from '../ui/dto-sizechart';
|
|
4
|
-
|
|
5
|
-
export interface ITitled {
|
|
6
|
-
title: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface ITitledRecord {
|
|
10
|
-
id?: string;
|
|
11
|
-
title?: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface ITitledRecordInfo {
|
|
15
|
-
id: string;
|
|
16
|
-
title: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// | MemberRoleWork;
|
|
20
|
-
|
|
21
|
-
export interface DtoTotal {
|
|
22
|
-
count: number;
|
|
23
|
-
day?: number;
|
|
24
|
-
week?: number;
|
|
25
|
-
month?: number;
|
|
26
|
-
quarter?: number;
|
|
27
|
-
year?: number;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface IDemoRecord {
|
|
31
|
-
id?: string;
|
|
32
|
-
isDemo?: boolean;
|
|
33
|
-
isLocal?: boolean;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface ITotalsHolder {
|
|
37
|
-
totals?: DtoTotals;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface DtoTotals {
|
|
41
|
-
incomes?: DtoTotal;
|
|
42
|
-
expenses?: DtoTotal;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// export interface Category extends ITitledRecord {
|
|
46
|
-
// id: string;
|
|
47
|
-
// }
|
|
48
|
-
|
|
49
|
-
export interface IWithSpaceIDs {
|
|
50
|
-
spaceIDs?: string[];
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export interface IWithTag {
|
|
54
|
-
tags?: string[];
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export interface IWithAssetIDs {
|
|
58
|
-
assetIDs?: string[];
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export interface IWithMemberIDs {
|
|
62
|
-
memberIDs?: string[];
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export interface IRealEstate {
|
|
66
|
-
leaseExpires?: string;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export interface IWithRestrictions {
|
|
70
|
-
restrictions?: Restriction[];
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function newTotal(): DtoTotal {
|
|
74
|
-
return { count: 0, day: 0, week: 0, month: 0, quarter: 0, year: 0 };
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export function newTotals(): DtoTotals {
|
|
78
|
-
// TODO: Rename to ITotalsDto
|
|
79
|
-
return { incomes: newTotal(), expenses: newTotal() };
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export function zeroIfEmptyTotals(totals: DtoTotals): DtoTotals {
|
|
83
|
-
const f = (t?: DtoTotal) =>
|
|
84
|
-
t
|
|
85
|
-
? {
|
|
86
|
-
count: t.count || 0,
|
|
87
|
-
day: t.day || 0,
|
|
88
|
-
week: t.week || 0,
|
|
89
|
-
month: t.month || 0,
|
|
90
|
-
quarter: t.quarter || 0,
|
|
91
|
-
year: t.year || 0,
|
|
92
|
-
}
|
|
93
|
-
: newTotal();
|
|
94
|
-
totals.incomes = f(totals.incomes);
|
|
95
|
-
totals.expenses = f(totals.expenses);
|
|
96
|
-
return totals;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export interface IVerification {
|
|
100
|
-
isVerified?: boolean;
|
|
101
|
-
verification?: {
|
|
102
|
-
confirmedBy?: string[]; // List of ID of users who confirmed validity of the member
|
|
103
|
-
rejectedBy?: string[]; // List of ID of users who questions validity of the member
|
|
104
|
-
};
|
|
105
|
-
}
|
package/src/lib/dto-pricing.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { SpaceType } from '@sneat/core';
|
|
2
|
-
|
|
3
|
-
export interface ISpaceBrief {
|
|
4
|
-
readonly title: string;
|
|
5
|
-
readonly type: SpaceType;
|
|
6
|
-
readonly parentSpaceID?: string;
|
|
7
|
-
readonly roles?: string[];
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const equalSpaceBriefs = (
|
|
11
|
-
v1?: ISpaceBrief | null | undefined,
|
|
12
|
-
v2?: ISpaceBrief | null | undefined,
|
|
13
|
-
): boolean => {
|
|
14
|
-
if (v1 === v2) return true;
|
|
15
|
-
return v1?.parentSpaceID === v2?.parentSpaceID && v1?.title === v2?.title;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const isSpaceSupportsMemberGroups = (t: SpaceType): boolean => {
|
|
19
|
-
return t === 'educator' || t === 'sport_club' || t === 'cohabit';
|
|
20
|
-
};
|
package/src/lib/dto-team-info.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { SpaceType } from '@sneat/core';
|
|
2
|
-
import { IUserCommuneInfo } from './dto-user';
|
|
3
|
-
|
|
4
|
-
export interface IShortSpaceInfo {
|
|
5
|
-
type: SpaceType;
|
|
6
|
-
id?: string;
|
|
7
|
-
// shortId?: CommuneShortId;
|
|
8
|
-
title?: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function createShortCommuneInfoFromUserCommuneInfo(
|
|
12
|
-
v: IUserCommuneInfo,
|
|
13
|
-
): IShortSpaceInfo {
|
|
14
|
-
return { id: v.id, title: v.title, /*shortId: v.shortId,*/ type: v.type };
|
|
15
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export type MetricColor =
|
|
2
|
-
| 'primary'
|
|
3
|
-
| 'secondary'
|
|
4
|
-
| 'tertiary'
|
|
5
|
-
| 'success'
|
|
6
|
-
| 'danger'
|
|
7
|
-
| 'warning';
|
|
8
|
-
|
|
9
|
-
export interface IBoolMetricVal {
|
|
10
|
-
label: string;
|
|
11
|
-
color: MetricColor;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface IBoolMetric {
|
|
15
|
-
true: IBoolMetricVal;
|
|
16
|
-
false: IBoolMetricVal;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface ISpaceMetric {
|
|
20
|
-
id?: string;
|
|
21
|
-
title: string;
|
|
22
|
-
colorTrue?: MetricColor;
|
|
23
|
-
colorFalse?: MetricColor;
|
|
24
|
-
type: 'bool' | 'integer' | 'options';
|
|
25
|
-
mode: 'personal' | 'team';
|
|
26
|
-
bool?: IBoolMetric;
|
|
27
|
-
min?: number;
|
|
28
|
-
max?: number;
|
|
29
|
-
}
|
package/src/lib/dto-team.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { ITotalsHolder } from './dto-models';
|
|
2
|
-
import { ISpaceBrief } from './dto-team-brief';
|
|
3
|
-
import { ISpaceMetric } from './dto-team-metric';
|
|
4
|
-
|
|
5
|
-
// export interface ITeamMeetings {
|
|
6
|
-
// scrum?: IMemberBrief;
|
|
7
|
-
// retrospective?: IMeetingInfo;
|
|
8
|
-
// }
|
|
9
|
-
|
|
10
|
-
export interface ISpaceDbo extends ISpaceBrief, ITotalsHolder {
|
|
11
|
-
readonly countryID: string;
|
|
12
|
-
readonly userIDs: string[];
|
|
13
|
-
// readonly members?: IMemberBrief[];
|
|
14
|
-
// readonly assets?: IAssetBrief[];
|
|
15
|
-
// readonly contacts?: IContactBrief[];
|
|
16
|
-
// readonly numberOf?: TeamCounts;
|
|
17
|
-
// readonly recurringHappenings?: { [id: string]: IHappeningBrief }; // TODO: Move to ISchedulusTeamDto
|
|
18
|
-
|
|
19
|
-
metrics: ISpaceMetric[];
|
|
20
|
-
// active?: ITeamMeetings;
|
|
21
|
-
// last?: ITeamMeetings;
|
|
22
|
-
upcomingRetro?: {
|
|
23
|
-
itemsByUserAndType?: Record<string, Record<string, number>>;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
noContactRoles?: string[]; // lists roles that have no contacts. For example families that have no plumber contacts.
|
|
27
|
-
}
|