@admin-layout/timetracker-module-server 1.0.3-alpha.7 → 1.0.3-alpha.81

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,12 +1,12 @@
1
- import { ITimeRecordRequest, ITimeRecord, ITimeTracker } from '@admin-layout/timetracker-core';
1
+ import { ITimeRecordRequest, ITimeRecord } from '@admin-layout/timetracker-core';
2
2
  export interface ITimeRecordRepository {
3
3
  getTimeRecords(orgId: string, userId?: string, startTime?: Date, endTime?: Date): Promise<Array<ITimeRecord>>;
4
4
  getOrganizationTimeRecords(orgId: string): Promise<Array<ITimeRecord>>;
5
5
  getPlayingTimeRecord(userId: string, orgId: string): Promise<ITimeRecord>;
6
- createTimeRecord(userId: string, orgId: string, request: ITimeRecordRequest): Promise<Partial<ITimeTracker>>;
7
- updateTimeRecord(userId: string, orgId: string, recordId: string, request: ITimeRecordRequest): Promise<Partial<ITimeTracker>>;
8
- removeTimeRecord(userId: string, orgId: string, recordId: string): Promise<Partial<ITimeTracker>>;
6
+ createTimeRecord(userId: string, orgId: string, request: ITimeRecordRequest): Promise<Partial<ITimeRecord>>;
7
+ updateTimeRecord(userId: string, orgId: string, recordId: string, request: ITimeRecordRequest): Promise<Partial<ITimeRecord>>;
8
+ removeTimeRecord(userId: string, orgId: string, recordId: string): Promise<Partial<ITimeRecord>>;
9
9
  removeDurationTimeRecords(userId: string, orgId: string, startTime: Date, endTime: Date, projectId: string): Promise<boolean>;
10
- approveTimeRecords(orgId: string, sheetId: string, startDate: Date, endDate: Date): any;
10
+ approveTimeRecords(orgId: string, sheetId: string, timeRecordsId: string[]): any;
11
11
  disapproveTimeRecords(orgId: string, sheetId: string): any;
12
12
  }
@@ -1,12 +1,12 @@
1
- import { ITimeRecord, ITimeRecordRequest, ITimeTracker } from '@admin-layout/timetracker-core';
1
+ import { ITimeRecord, ITimeRecordRequest } from '@admin-layout/timetracker-core';
2
2
  export interface ITimeRecordService {
3
3
  getTimeRecords(orgId: string, userId?: string): Promise<Array<ITimeRecord>>;
4
4
  getDurationTimeRecords(orgId: string, startTime: Date, endTime: Date, userId?: string): Promise<Array<ITimeRecord>>;
5
5
  getPlayingTimeRecord(userId: string, orgId: string): Promise<ITimeRecord>;
6
- createTimeRecord(userId: string, orgId: string, request: ITimeRecordRequest): Promise<Partial<ITimeTracker>>;
6
+ createTimeRecord(userId: string, orgId: string, request: ITimeRecordRequest): Promise<Partial<ITimeRecord>>;
7
7
  updateTimeRecord(userId: string, orgId: string, recordId: string, request: ITimeRecordRequest): Promise<boolean>;
8
8
  removeTimeRecord(userId: string, orgId: string, recordId: string): Promise<boolean>;
9
9
  removeDurationTimeRecords(userId: string, orgId: string, startTime: Date, endTime: Date, projectId: string): Promise<boolean>;
10
- approveTimeRecords(orgId: string, sheetId: string, startDate: Date, endDate: Date): any;
10
+ approveTimeRecords(orgId: string, sheetId: string, timeRecordsId: string[]): any;
11
11
  disapproveTimeRecords(orgId: string, sheetId: string): any;
12
12
  }
@@ -6,4 +6,5 @@ export interface ITimesheetRepository {
6
6
  updateTimesheet(orgId: string, sheetId: string, request: ITimesheetCreateRequest): any;
7
7
  updateTimesheetStatus(orgId: string, sheetId: string, state: ITimesheetState): any;
8
8
  removeTimesheet(userId: string, orgId: string, sheetId: string): Promise<boolean>;
9
+ removeTimeRecordIdFromTimesheet(recordId: string, orgId: string): Promise<boolean>;
9
10
  }
@@ -7,4 +7,5 @@ export interface ITimesheetService {
7
7
  updateTimesheet(userId: string, orgId: string, sheetId: string, request: ITimesheetCreateRequest, userContext?: any): Promise<boolean>;
8
8
  updateTimesheetStatus(orgId: string, sheetId: string, state: ITimesheetState): Promise<boolean>;
9
9
  removeTimesheet(userId: string, orgId: string, sheetId: string): Promise<boolean>;
10
+ removeTimeRecordIdFromTimesheet(recordId: string, orgId: string): Promise<boolean>;
10
11
  }
@@ -0,0 +1,2 @@
1
+ export * from './timesheet-moleculer-service';
2
+ export * from './timerecord-moleculer-service';
@@ -0,0 +1,8 @@
1
+ import { Service, ServiceBroker } from 'moleculer';
2
+ import { Container } from 'inversify';
3
+ export declare class TimeRecordMoleculerService extends Service {
4
+ private timerecordService;
5
+ constructor(broker: ServiceBroker, { container, ...settings }: {
6
+ container: Container;
7
+ });
8
+ }
@@ -0,0 +1,9 @@
1
+ import { Service, ServiceBroker } from 'moleculer';
2
+ import { Container } from 'inversify';
3
+ export declare class TimesheetMoleculerService extends Service {
4
+ private timesheetService;
5
+ private container;
6
+ constructor(broker: ServiceBroker, { container, ...settings }: {
7
+ container: Container;
8
+ });
9
+ }
@@ -1,5 +1,4 @@
1
1
  import { IPermissionType } from '@adminide-stack/core';
2
- import { IPreDefineAccountPermissions } from '../../constants';
3
2
  export declare const TimeTrackerRolesPermissionOverwrite: {
4
3
  OWNER: {
5
4
  "organization.timetracker.self.view": IPermissionType;
@@ -1,2 +1,4 @@
1
1
  export * from './timesheet-service';
2
2
  export * from './timerecord-service';
3
+ export * from './timerecord-proxy-service';
4
+ export * from './timesheet-proxy-service';
@@ -0,0 +1,20 @@
1
+ import { ServiceBroker } from 'moleculer';
2
+ import * as Logger from 'bunyan';
3
+ import { ITimeRecord, ITimeRecordRequest } from '@admin-layout/timetracker-core';
4
+ import { ITimeRecordService } from '../interfaces';
5
+ export declare class TimeRecordProxyService implements ITimeRecordService {
6
+ broker: ServiceBroker;
7
+ private logger;
8
+ private topic;
9
+ constructor(broker: ServiceBroker, logger: Logger);
10
+ approveTimeRecords(orgId: string, sheetId: string, timeRecordsId: string[]): Promise<unknown>;
11
+ createTimeRecord(userId: string, orgId: string, request: ITimeRecordRequest): Promise<Partial<ITimeRecord>>;
12
+ disapproveTimeRecords(orgId: string, sheetId: string): Promise<unknown>;
13
+ getDurationTimeRecords(orgId: string, startTime: Date, endTime: Date, userId?: string): Promise<Array<ITimeRecord>>;
14
+ getPlayingTimeRecord(userId: string, orgId: string): Promise<ITimeRecord>;
15
+ getTimeRecords(orgId: string, userId?: string): Promise<Array<ITimeRecord>>;
16
+ removeDurationTimeRecords(userId: string, orgId: string, startTime: Date, endTime: Date, projectId: string): Promise<boolean>;
17
+ removeTimeRecord(userId: string, orgId: string, recordId: string): Promise<boolean>;
18
+ updateTimeRecord(userId: string, orgId: string, recordId: string, request: ITimeRecordRequest): Promise<boolean>;
19
+ private callAction;
20
+ }
@@ -1,17 +1,15 @@
1
1
  import { CdmLogger } from '@cdm-logger/core';
2
2
  import { ITimeRecord, ITimeRecordRequest } from '@admin-layout/timetracker-core';
3
- import { IPreferencesService } from '@adminide-stack/core';
4
3
  import { PubSubEngine } from 'graphql-subscriptions';
5
4
  import { ServiceBroker } from 'moleculer';
6
5
  import { ITimeRecordRepository } from '../interfaces';
7
6
  import { ITimeRecordService } from '../interfaces/timerecord-service';
8
7
  export declare class TimeRecordService implements ITimeRecordService {
9
8
  protected timeRecordRepository: ITimeRecordRepository;
10
- private preferencesService;
11
9
  private broker;
12
10
  private pubsub;
13
11
  private logger;
14
- constructor(timeRecordRepository: ITimeRecordRepository, preferencesService: IPreferencesService, broker: ServiceBroker, pubsub: PubSubEngine, logger: CdmLogger.ILogger);
12
+ constructor(timeRecordRepository: ITimeRecordRepository, broker: ServiceBroker, pubsub: PubSubEngine, logger: CdmLogger.ILogger);
15
13
  getTimeRecords(orgId: string, userId: string): Promise<Array<ITimeRecord>>;
16
14
  getDurationTimeRecords(orgId: string, startTime: Date, endTime: Date, userId?: string): Promise<Array<ITimeRecord>>;
17
15
  getPlayingTimeRecord(userId: string, orgId: string): Promise<ITimeRecord>;
@@ -19,6 +17,6 @@ export declare class TimeRecordService implements ITimeRecordService {
19
17
  updateTimeRecord(userId: string, orgId: string, recordId: string, request: ITimeRecordRequest): Promise<boolean>;
20
18
  removeTimeRecord(userId: string, orgId: string, recordId: string): Promise<boolean>;
21
19
  removeDurationTimeRecords(userId: string, orgId: string, startTime: Date, endTime: Date, projectId: string): Promise<boolean>;
22
- approveTimeRecords(orgId: string, sheetId: string, startDate: Date, endDate: Date): Promise<void>;
20
+ approveTimeRecords(orgId: string, sheetId: string, timeRecordsId: string[]): Promise<void>;
23
21
  disapproveTimeRecords(orgId: string, sheetId: string): Promise<void>;
24
22
  }
@@ -0,0 +1,19 @@
1
+ import { ServiceBroker } from 'moleculer';
2
+ import * as Logger from 'bunyan';
3
+ import { ITimesheetCreateRequest, ITimesheet, ITimesheetState } from '@admin-layout/timetracker-core';
4
+ import { ITimesheetService } from '../interfaces';
5
+ export declare class TimesheetProxyService implements ITimesheetService {
6
+ broker: ServiceBroker;
7
+ private logger;
8
+ private topic;
9
+ constructor(broker: ServiceBroker, logger: Logger);
10
+ createTimesheet(userId: string, orgId: string, request: ITimesheetCreateRequest): Promise<boolean>;
11
+ getDurationTimesheets(orgId: string, start: Date, end: Date): Promise<Array<ITimesheet>>;
12
+ getTimesheets(orgId: string): Promise<Array<ITimesheet>>;
13
+ getTimesheetsWithTotalHours(orgId: string, userId?: string): Promise<Array<ITimesheet>>;
14
+ removeTimesheet(userId: string, orgId: string, sheetId: string): Promise<boolean>;
15
+ removeTimeRecordIdFromTimesheet(recordId: string, orgId: string): Promise<boolean>;
16
+ updateTimesheet(userId: string, orgId: string, sheetId: string, request: ITimesheetCreateRequest, userContext?: any): Promise<boolean>;
17
+ updateTimesheetStatus(orgId: string, sheetId: string, state: ITimesheetState): Promise<boolean>;
18
+ private callAction;
19
+ }
@@ -13,7 +13,7 @@ export declare class TimesheetService implements ITimesheetService {
13
13
  private settings;
14
14
  private logger;
15
15
  constructor(timesheetRepository: ITimesheetRepository, timeRecordRepository: ITimeRecordRepository, timeRecordService: ITimeRecordRepository, preferencesService: IPreferencesService, broker: ServiceBroker, settings: any, logger: ILogger);
16
- getTimesheets(orgId: string, userId?: string): Promise<import("../../../core/lib").ITimesheet[]>;
16
+ getTimesheets(orgId: string, userId?: string): Promise<import("@admin-layout/timetracker-core").ITimesheet[]>;
17
17
  getTimesheetsWithTotalHours(orgId: string, userId?: string): Promise<{
18
18
  id: string;
19
19
  startDate: any;
@@ -26,13 +26,15 @@ export declare class TimesheetService implements ITimesheetService {
26
26
  submittedOn: any;
27
27
  updatedBy: string;
28
28
  updatedOn: any;
29
+ timeRecordsId: string[];
29
30
  totalDuration: number;
30
31
  }[]>;
31
- getDurationTimesheets(orgId: string, start: Date, end: Date): Promise<import("../../../core/lib").ITimesheet[]>;
32
+ getDurationTimesheets(orgId: string, start: Date, end: Date): Promise<import("@admin-layout/timetracker-core").ITimesheet[]>;
32
33
  createTimesheet(userId: string, orgId: string, request: ITimesheetCreateRequest): Promise<boolean>;
33
34
  updateTimesheet(userId: string, orgId: string, sheetId: string, request: ITimesheetCreateRequest, userContext?: any): Promise<boolean>;
34
35
  updateTimesheetStatus(orgId: string, sheetId: string, state: ITimesheetState): Promise<boolean>;
35
36
  removeTimesheet(userId: string, orgId: string, sheetId: string): Promise<boolean>;
36
37
  private sendMail;
38
+ removeTimeRecordIdFromTimesheet(recordId: string, orgId: string): Promise<boolean>;
37
39
  private callAction;
38
40
  }
@@ -0,0 +1,8 @@
1
+ import { Model, Document, Connection } from 'mongoose';
2
+ import { ITimeRecord } from '@admin-layout/timetracker-core';
3
+ export declare type Maybe<T> = T | null;
4
+ export interface ITimeRecordModel extends ITimeRecord, Document {
5
+ id?: any;
6
+ }
7
+ export declare type TimeRecordsModelType = Model<ITimeRecordModel>;
8
+ export declare const TimeRecordsModelFunc: (db: Connection) => TimeRecordsModelType;
@@ -0,0 +1,8 @@
1
+ import { Model, Document, Connection } from 'mongoose';
2
+ import { ITimesheet } from '@admin-layout/timetracker-core';
3
+ export declare type Maybe<T> = T | null;
4
+ export interface ITimeSheetModel extends ITimesheet, Document {
5
+ id?: any;
6
+ }
7
+ export declare type TimesheetsModelType = Model<ITimeSheetModel>;
8
+ export declare const TimesheetsModelFunc: (db: Connection) => TimesheetsModelType;
@@ -1,23 +1,23 @@
1
1
  import * as Logger from 'bunyan';
2
2
  import * as mongoose from 'mongoose';
3
- import { ITimeRecordRequest, ITimeRecord, ITimeTracker } from '@admin-layout/timetracker-core';
4
- import { ITimeRecordModel, ITimeTrackerModel } from '../models/timetracker-model';
3
+ import { ITimeRecordRequest, ITimeRecord } from '@admin-layout/timetracker-core';
5
4
  import { ITimeRecordRepository } from '../../interfaces';
5
+ import { ITimeRecordModel } from '../models/timerecords-model';
6
6
  export declare class TimeRecordRepository implements ITimeRecordRepository {
7
- private timeTrackerModel;
7
+ private timeRecordsModel;
8
8
  private logger;
9
9
  constructor(db: mongoose.Connection, logger: Logger);
10
- getTimeRecords(orgId: string, userId?: string | RegExp, from?: Date, until?: Date): Promise<any>;
10
+ getTimeRecords(orgId: string, userId?: string | RegExp, from?: Date, until?: Date): Promise<Array<ITimeRecord>>;
11
11
  getOrganizationTimeRecords(orgId: string): Promise<ITimeRecordModel[]>;
12
12
  getPlayingTimeRecord(userId: string, orgId: string): Promise<ITimeRecord>;
13
- createTimeRecord(userId: string, orgId: string, request: ITimeRecordRequest): Promise<Partial<ITimeTracker>>;
14
- updateTimeRecord(userId: string, orgId: string, recordId: string, request: ITimeRecordRequest): Promise<Partial<ITimeTrackerModel>>;
13
+ createTimeRecord(userId: string, orgId: string, request: ITimeRecordRequest): Promise<Partial<ITimeRecord>>;
14
+ updateTimeRecord(userId: string, orgId: string, recordId: string, request: ITimeRecordRequest): Promise<Partial<ITimeRecordModel>>;
15
15
  removeTimeRecord(userId: string, orgId: string, recordId: string): Promise<{
16
16
  userId: string;
17
17
  orgId: string;
18
- timeRecords: ITimeRecord[];
18
+ _id: string;
19
19
  }>;
20
20
  removeDurationTimeRecords(userId: string, orgId: string, startTime: Date, endTime: Date, projectId: string): Promise<boolean>;
21
- approveTimeRecords(orgId: string, sheetId: string, startDate: Date, endDate: Date): Promise<void>;
21
+ approveTimeRecords(orgId: string, sheetId: string, timeRecordsId: string[]): Promise<void>;
22
22
  disapproveTimeRecords(orgId: string, sheetId: string): Promise<void>;
23
23
  }
@@ -2,11 +2,11 @@ import * as Logger from 'bunyan';
2
2
  import * as mongoose from 'mongoose';
3
3
  import { ITimesheetCreateRequest, ITimesheetState } from '@admin-layout/timetracker-core';
4
4
  import { ServiceBroker } from 'moleculer';
5
- import { ITimeSheetModel } from '../models/timetracker-model';
5
+ import { ITimeSheetModel } from '../models/timesheets-model';
6
6
  import { ITimesheetRepository } from '../../interfaces';
7
7
  export declare class TimesheetRepository implements ITimesheetRepository {
8
8
  private broker;
9
- private timeTrackerModel;
9
+ private timesheetsModel;
10
10
  private logger;
11
11
  constructor(db: mongoose.Connection, logger: Logger, broker: ServiceBroker);
12
12
  getOrganizationTimesheets(orgId: string): Promise<ITimeSheetModel[]>;
@@ -15,4 +15,5 @@ export declare class TimesheetRepository implements ITimesheetRepository {
15
15
  updateTimesheet(orgId: string, sheetId: string, request: ITimesheetCreateRequest): Promise<mongoose.UpdateWriteOpResult>;
16
16
  updateTimesheetStatus(orgId: string, sheetId: string, state: ITimesheetState): Promise<mongoose.UpdateWriteOpResult>;
17
17
  removeTimesheet(userId: string, orgId: string, sheetId: string): Promise<boolean>;
18
+ removeTimeRecordIdFromTimesheet(recordId: string, orgId: string): Promise<boolean>;
18
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@admin-layout/timetracker-module-server",
3
- "version": "1.0.3-alpha.7",
3
+ "version": "1.0.3-alpha.81",
4
4
  "description": "Sample core for higher packages to depend on",
5
5
  "license": "ISC",
6
6
  "author": "CDMBase LLC",
@@ -13,8 +13,6 @@
13
13
  "build:lib:watch": "npm run build:lib -- --watch",
14
14
  "jest": "./node_modules/.bin/jest",
15
15
  "prepublish": "npm run build",
16
- "schema:download": "./node_modules/.bin/apollo-codegen download-schema http://localhost:8080/graphql --output schema.json ",
17
- "schema:generate": "./node_modules/.bin/apollo-codegen generate src/browser/graphql/**/*.graphql --schema schema.json --target typescript --output src/browser/types/schema.ts",
18
16
  "test": "cross-env ENV_FILE=../../config/test/test.env jest",
19
17
  "test:debug": "npm test -- --runInBand",
20
18
  "test:watch": "npm test -- --watch",
@@ -40,15 +38,16 @@
40
38
  }
41
39
  },
42
40
  "dependencies": {
43
- "@admin-layout/timetracker-core": "1.0.3-alpha.2",
41
+ "@admin-layout/timetracker-core": "1.0.3-alpha.78",
44
42
  "@container-stack/mailing-api": "^0.0.26-61",
45
43
  "humanize-duration": "^3.24.0",
46
44
  "moment": "^2.29.1"
47
45
  },
48
46
  "peerDependencies": {
49
47
  "@adminide-stack/core": "*",
48
+ "@adminide-stack/platform-server": "*",
50
49
  "@common-stack/core": "*",
51
- "@common-stack/server-core": ">=0.1.7",
50
+ "@common-stack/server-core": ">=0.1.11",
52
51
  "@vscode-alt/monaco-editor": "*",
53
52
  "bunyan": "*",
54
53
  "inversify": "*",
@@ -62,5 +61,5 @@
62
61
  "typescript": {
63
62
  "definition": "lib/index.d.ts"
64
63
  },
65
- "gitHead": "300a5bd3c146c703fc2895aca0318012e7edb094"
64
+ "gitHead": "2b92540429feec9f4cfbdaaefeb142e2d0c9b257"
66
65
  }