@things-factory/operato-gangsters 5.0.14 → 6.0.0-alpha.3
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/client/{bootstrap.js → bootstrap.ts} +3 -3
- package/client/{index.js → index.ts} +0 -0
- package/client/{menu.js → menu.ts} +1 -3
- package/client/pages/{main.js → main.ts} +6 -10
- package/client/pages/weekly-report/{weekly-report-importer.js → weekly-report-importer.ts} +29 -35
- package/client/pages/weekly-report/{weekly-report-list-page.js → weekly-report-list-page.ts} +11 -15
- package/client/pages/{weekly-report-calendar-evt-provider.js → weekly-report-calendar-evt-provider.ts} +0 -0
- package/client/pages/{weekly-report-calendar.js → weekly-report-calendar.ts} +7 -11
- package/client/pages/{weekly-report-editor.js → weekly-report-editor.ts} +30 -30
- package/client/pages/{weekly-report-preview-popup.js → weekly-report-preview-popup.ts} +6 -26
- package/client/{route.js → route.ts} +4 -4
- package/client/tsconfig.json +12 -0
- package/db.sqlite +0 -0
- package/dist-server/service/weekly-report/weekly-report-mutation.js +5 -5
- package/dist-server/service/weekly-report/weekly-report-mutation.js.map +1 -1
- package/dist-server/service/weekly-report/weekly-report-query.js +10 -12
- package/dist-server/service/weekly-report/weekly-report-query.js.map +1 -1
- package/dist-server/service/weekly-report/weekly-report.js +4 -5
- package/dist-server/service/weekly-report/weekly-report.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/logs/.08636eb59927f12972f6774f5947c8507b3564c2-audit.json +12 -47
- package/logs/.5e5d741d8b7784a2fbad65eedc0fd46946aaf6f2-audit.json +6 -106
- package/logs/application-2022-09-13-14.log +6 -0
- package/logs/application-2022-09-13-15.log +6 -0
- package/logs/application-2022-09-13-23.log +19 -0
- package/logs/application-2022-09-14-00.log +19 -0
- package/logs/{connections-2022-06-12-00.log → connections-2022-09-13-14.log} +0 -0
- package/logs/{connections-2022-06-12-09.log → connections-2022-09-13-15.log} +0 -0
- package/package.json +37 -34
- package/server/service/weekly-report/weekly-report-mutation.ts +15 -14
- package/server/service/weekly-report/weekly-report-query.ts +10 -11
- package/server/tsconfig.json +9 -0
- package/{things-factory.config.js → things-factory.config.ts} +0 -0
- package/attachments/1a491fdc-d977-42c5-9597-05950c5535d9.jpg +0 -0
- package/attachments/210ee74d-6985-46ac-9a67-66bba4706ff4.jpg +0 -0
- package/attachments/2c0099c2-bc01-4e5e-bb6a-9857b9067cd3.jpg +0 -0
- package/attachments/552ff912-efe0-4d5b-9dbf-10ab4d656630.jpg +0 -0
- package/attachments/68a87b07-0f1f-40bf-8b21-eb8b11e16540.jpg +0 -0
- package/attachments/72fa9ccb-5ecc-4758-a589-c013268f2419.jpg +0 -0
- package/attachments/89740d46-f778-473a-bfdf-183f8fbf232a.jpg +0 -0
- package/attachments/ad59bc67-fb3d-49b5-bad3-2ac64aadded8.jpg +0 -0
- package/attachments/b6d6564f-fd4e-4857-b266-7208a656f2c6.jpg +0 -0
- package/attachments/caa1893a-b569-462a-b9de-527084e5f18b.jpg +0 -0
- package/client/actions/main.js +0 -1
- package/client/reducers/main.js +0 -17
- package/logs/application-2022-06-12-00.log +0 -10
- package/logs/application-2022-06-12-09.log +0 -4
- package/logs/application-2022-06-12-10.log +0 -19
- package/logs/application-2022-06-12-11.log +0 -7
- package/logs/application-2022-06-12-12.log +0 -22
- package/logs/application-2022-06-12-13.log +0 -8
- package/logs/application-2022-06-12-21.log +0 -19
- package/logs/application-2022-06-12-22.log +0 -6
- package/logs/application-2022-06-12-23.log +0 -17
- package/logs/application-2022-06-13-00.log +0 -4
- package/logs/application-2022-06-13-09.log +0 -17
- package/logs/application-2022-06-13-13.log +0 -4
- package/logs/application-2022-08-09-11.log +0 -4
- package/logs/application-2022-08-09-12.log +0 -9
- package/logs/application-2022-08-09-22.log +0 -4
- package/logs/application-2022-08-09-23.log +0 -4
- package/logs/application-2022-08-10-00.log +0 -4
- package/logs/application-2022-08-10-01.log +0 -4
- package/logs/application-2022-08-10-14.log +0 -11
- package/logs/application-2022-08-10-16.log +0 -4
- package/logs/application-2022-08-10-22.log +0 -12
- package/logs/application-2022-08-10-23.log +0 -4
- package/logs/application-2022-08-11-10.log +0 -4
- package/logs/connections-2022-06-12-10.log +0 -0
- package/logs/connections-2022-06-12-11.log +0 -0
- package/logs/connections-2022-06-12-12.log +0 -0
- package/logs/connections-2022-06-12-13.log +0 -0
- package/logs/connections-2022-06-12-21.log +0 -0
- package/logs/connections-2022-06-12-22.log +0 -0
- package/logs/connections-2022-06-12-23.log +0 -0
- package/logs/connections-2022-06-13-00.log +0 -0
- package/logs/connections-2022-06-13-09.log +0 -0
- package/logs/connections-2022-06-13-13.log +0 -0
- package/logs/connections-2022-07-31-16.log +0 -0
- package/logs/connections-2022-07-31-17.log +0 -0
- package/logs/connections-2022-07-31-18.log +0 -0
- package/logs/connections-2022-08-01-11.log +0 -0
- package/logs/connections-2022-08-01-21.log +0 -0
- package/logs/connections-2022-08-05-23.log +0 -0
- package/logs/connections-2022-08-08-18.log +0 -0
- package/logs/connections-2022-08-08-21.log +0 -0
- package/logs/connections-2022-08-08-22.log +0 -0
- package/logs/connections-2022-08-08-23.log +0 -0
- package/logs/connections-2022-08-09-00.log +0 -0
- package/logs/connections-2022-08-09-11.log +0 -0
- package/logs/connections-2022-08-09-12.log +0 -0
- package/logs/connections-2022-08-09-22.log +0 -0
- package/logs/connections-2022-08-09-23.log +0 -0
- package/logs/connections-2022-08-10-00.log +0 -0
- package/logs/connections-2022-08-10-01.log +0 -0
- package/logs/connections-2022-08-10-14.log +0 -0
- package/logs/connections-2022-08-10-16.log +0 -0
- package/logs/connections-2022-08-10-22.log +0 -0
- package/logs/connections-2022-08-10-23.log +0 -0
- package/logs/connections-2022-08-11-10.log +0 -0
- package/logs/system/.a107e5e632c50bcc2efd96dbb09e06b829c3c669-audit.json +0 -35
- package/logs/system/scenario-a-2022-07-16-22.log +0 -348
- package/logs/system/scenario-a-2022-07-16-23.log +0 -363
- package/logs/system/scenario-a-2022-07-17-12.log +0 -767
- package/logs/system/scenario-a-2022-07-17-13.log +0 -4833
- package/logs/system/scenario-a-2022-07-17-14.log +0 -3331
- package/tsconfig.json +0 -9
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { html } from 'lit-html'
|
|
2
2
|
|
|
3
|
-
import { registerDefaultGroups } from '@operato/board
|
|
3
|
+
import { registerDefaultGroups } from '@operato/board'
|
|
4
|
+
import { navigate, store } from '@operato/shell'
|
|
4
5
|
import { APPEND_APP_TOOL } from '@things-factory/apptool-base'
|
|
5
|
-
import { auth } from '@things-factory/auth-base'
|
|
6
|
+
import { auth } from '@things-factory/auth-base/dist-client'
|
|
6
7
|
import { setAuthManagementMenus } from '@things-factory/auth-ui'
|
|
7
8
|
import { appendViewpart, toggleOverlay, TOOL_POSITION, VIEWPART_POSITION } from '@things-factory/layout-base'
|
|
8
9
|
import { setupMenuPart, updateMenuTemplate } from '@things-factory/lite-menu'
|
|
9
10
|
import { ADD_MORENDA } from '@things-factory/more-base'
|
|
10
11
|
import { ADD_SETTING } from '@things-factory/setting-base'
|
|
11
|
-
import { navigate, store } from '@things-factory/shell'
|
|
12
12
|
|
|
13
13
|
import { getMenuTemplate } from './menu'
|
|
14
14
|
|
|
File without changes
|
|
@@ -3,8 +3,6 @@ import i18next from 'i18next'
|
|
|
3
3
|
|
|
4
4
|
import { subscribe } from '@operato/graphql'
|
|
5
5
|
|
|
6
|
-
var subscriber
|
|
7
|
-
|
|
8
6
|
async function subscribeActivityInstance() {
|
|
9
7
|
return await subscribe(
|
|
10
8
|
{
|
|
@@ -29,7 +27,7 @@ async function subscribeActivityInstance() {
|
|
|
29
27
|
|
|
30
28
|
export function getMenuTemplate(owner) {
|
|
31
29
|
requestAnimationFrame(async () => {
|
|
32
|
-
subscriber = await subscribeActivityInstance()
|
|
30
|
+
const subscriber = await subscribeActivityInstance()
|
|
33
31
|
})
|
|
34
32
|
|
|
35
33
|
return [
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
|
|
3
|
-
import { css, html } from 'lit
|
|
3
|
+
import { css, html } from 'lit'
|
|
4
|
+
import { customElement, property } from 'lit/decorators.js'
|
|
4
5
|
import { connect } from 'pwa-helpers/connect-mixin.js'
|
|
5
6
|
import ReactDOM from 'react-dom/client'
|
|
6
7
|
|
|
8
|
+
import { PageView, store } from '@operato/shell'
|
|
7
9
|
import SendbirdApp from '@sendbird/uikit-react/App'
|
|
8
|
-
import { PageView, store } from '@things-factory/shell'
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
@customElement('operato-gangsters-main')
|
|
12
|
+
export class OperatoGangstersMain extends connect(store)(PageView) {
|
|
11
13
|
static get styles() {
|
|
12
14
|
return [
|
|
13
15
|
css`
|
|
@@ -27,11 +29,7 @@ class OperatoGangstersMain extends connect(store)(PageView) {
|
|
|
27
29
|
]
|
|
28
30
|
}
|
|
29
31
|
|
|
30
|
-
|
|
31
|
-
return {
|
|
32
|
-
operatoGangsters: String
|
|
33
|
-
}
|
|
34
|
-
}
|
|
32
|
+
@property({ type: String }) operatoGangsteres = ''
|
|
35
33
|
|
|
36
34
|
render() {
|
|
37
35
|
return html`<slot></slot>`
|
|
@@ -50,5 +48,3 @@ class OperatoGangstersMain extends connect(store)(PageView) {
|
|
|
50
48
|
//this.operatoGangsters = state.operatoGangsters.state_main
|
|
51
49
|
}
|
|
52
50
|
}
|
|
53
|
-
|
|
54
|
-
window.customElements.define('operato-gangsters-main', OperatoGangstersMain)
|
|
@@ -2,45 +2,41 @@ import '@operato/data-grist'
|
|
|
2
2
|
|
|
3
3
|
import gql from 'graphql-tag'
|
|
4
4
|
import { css, html, LitElement } from 'lit'
|
|
5
|
+
import { customElement, property } from 'lit/decorators.js'
|
|
5
6
|
|
|
6
7
|
import { client } from '@operato/graphql'
|
|
7
8
|
import { i18next } from '@operato/i18n'
|
|
9
|
+
import { isMobileDevice } from '@operato/utils'
|
|
8
10
|
|
|
11
|
+
@customElement('weekly-report-importer')
|
|
9
12
|
export class WeeklyReportImporter extends LitElement {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
@property({ type: Object })
|
|
14
|
+
columns = {
|
|
15
|
+
list: { fields: ['name', 'description'] },
|
|
16
|
+
pagination: { infinite: true },
|
|
17
|
+
columns: [
|
|
18
|
+
{
|
|
19
|
+
type: 'string',
|
|
20
|
+
name: 'name',
|
|
21
|
+
header: i18next.t('field.name'),
|
|
22
|
+
width: 150
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
type: 'string',
|
|
26
|
+
name: 'description',
|
|
27
|
+
header: i18next.t('field.description'),
|
|
28
|
+
width: 200
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: 'checkbox',
|
|
32
|
+
name: 'active',
|
|
33
|
+
header: i18next.t('field.active'),
|
|
34
|
+
width: 60
|
|
35
|
+
}
|
|
36
|
+
]
|
|
15
37
|
}
|
|
16
38
|
|
|
17
|
-
|
|
18
|
-
super()
|
|
19
|
-
this.columns = {
|
|
20
|
-
list: { fields: ['name', 'description'] },
|
|
21
|
-
pagination: { infinite: true },
|
|
22
|
-
columns: [
|
|
23
|
-
{
|
|
24
|
-
type: 'string',
|
|
25
|
-
name: 'name',
|
|
26
|
-
header: i18next.t('field.name'),
|
|
27
|
-
width: 150
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
type: 'string',
|
|
31
|
-
name: 'description',
|
|
32
|
-
header: i18next.t('field.description'),
|
|
33
|
-
width: 200
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
type: 'checkbox',
|
|
37
|
-
name: 'active',
|
|
38
|
-
header: i18next.t('field.active'),
|
|
39
|
-
width: 60
|
|
40
|
-
}
|
|
41
|
-
]
|
|
42
|
-
}
|
|
43
|
-
}
|
|
39
|
+
@property({ type: Array }) weeklyReports = []
|
|
44
40
|
|
|
45
41
|
static get styles() {
|
|
46
42
|
return [
|
|
@@ -95,10 +91,8 @@ export class WeeklyReportImporter extends LitElement {
|
|
|
95
91
|
variables: { weeklyReports: this.weeklyReports }
|
|
96
92
|
})
|
|
97
93
|
|
|
98
|
-
if (response.
|
|
94
|
+
if (response.errors?.length) return
|
|
99
95
|
|
|
100
96
|
this.dispatchEvent(new CustomEvent('imported'))
|
|
101
97
|
}
|
|
102
98
|
}
|
|
103
|
-
|
|
104
|
-
window.customElements.define('weekly-report-importer', WeeklyReportImporter)
|
package/client/pages/weekly-report/{weekly-report-list-page.js → weekly-report-list-page.ts}
RENAMED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import '@operato/data-grist'
|
|
2
|
-
import './weekly-report-importer
|
|
2
|
+
import './weekly-report-importer'
|
|
3
3
|
|
|
4
4
|
import gql from 'graphql-tag'
|
|
5
5
|
import { css, html } from 'lit'
|
|
6
|
+
import { customElement, property, query } from 'lit/decorators.js'
|
|
6
7
|
import { connect } from 'pwa-helpers/connect-mixin'
|
|
7
8
|
|
|
8
9
|
import { client } from '@operato/graphql'
|
|
@@ -12,13 +13,14 @@ import { PageView, store } from '@operato/shell'
|
|
|
12
13
|
import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
|
|
13
14
|
import { isMobileDevice } from '@operato/utils'
|
|
14
15
|
|
|
16
|
+
@customElement('weekly-report-list-page')
|
|
15
17
|
export class WeeklyReportListPage extends connect(store)(localize(i18next)(PageView)) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
@property({ type: String }) mode = ''
|
|
19
|
+
@property({ type: Object }) gristConfig = {}
|
|
20
|
+
|
|
21
|
+
// TODO(appano1): Add types to Shadow DOM elements
|
|
22
|
+
@query('#sorter-control') sorterController
|
|
23
|
+
@query('ox-grist') grist
|
|
22
24
|
|
|
23
25
|
static get styles() {
|
|
24
26
|
return [
|
|
@@ -78,7 +80,7 @@ export class WeeklyReportListPage extends connect(store)(localize(i18next)(PageV
|
|
|
78
80
|
<mwc-icon
|
|
79
81
|
@click=${e => {
|
|
80
82
|
const target = e.currentTarget
|
|
81
|
-
this.
|
|
83
|
+
this.sorterController.open({
|
|
82
84
|
right: 0,
|
|
83
85
|
top: target.offsetTop + target.offsetHeight
|
|
84
86
|
})
|
|
@@ -100,10 +102,6 @@ export class WeeklyReportListPage extends connect(store)(localize(i18next)(PageV
|
|
|
100
102
|
`
|
|
101
103
|
}
|
|
102
104
|
|
|
103
|
-
get grist() {
|
|
104
|
-
return this.renderRoot.querySelector('ox-grist')
|
|
105
|
-
}
|
|
106
|
-
|
|
107
105
|
async pageInitialized(lifecycle) {
|
|
108
106
|
this.gristConfig = {
|
|
109
107
|
list: {
|
|
@@ -288,7 +286,7 @@ export class WeeklyReportListPage extends connect(store)(localize(i18next)(PageV
|
|
|
288
286
|
let patches = this.grist.dirtyRecords
|
|
289
287
|
if (patches && patches.length) {
|
|
290
288
|
patches = patches.map(patch => {
|
|
291
|
-
let patchField = patch.id ? { id: patch.id } : {}
|
|
289
|
+
let patchField: any = patch.id ? { id: patch.id } : {}
|
|
292
290
|
const dirtyFields = patch.__dirtyfields__
|
|
293
291
|
for (let key in dirtyFields) {
|
|
294
292
|
patchField[key] = dirtyFields[key].after
|
|
@@ -364,5 +362,3 @@ export class WeeklyReportListPage extends connect(store)(localize(i18next)(PageV
|
|
|
364
362
|
}
|
|
365
363
|
}
|
|
366
364
|
}
|
|
367
|
-
|
|
368
|
-
window.customElements.define('weekly-report-list-page', WeeklyReportListPage)
|
|
File without changes
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import '@operato/event-view'
|
|
2
2
|
|
|
3
|
-
import { css, html } from 'lit
|
|
3
|
+
import { css, html } from 'lit'
|
|
4
|
+
import { customElement, property } from 'lit/decorators.js'
|
|
4
5
|
import { connect } from 'pwa-helpers/connect-mixin.js'
|
|
5
6
|
|
|
6
|
-
import { PageView, store } from '@
|
|
7
|
+
import { PageView, store } from '@operato/shell'
|
|
7
8
|
|
|
8
9
|
import { WeeklyReportCalendarEventProvider } from './weekly-report-calendar-evt-provider'
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
@customElement('weekly-report-calendar-page')
|
|
12
|
+
export class WeeklyReportCalendar extends connect(store)(PageView) {
|
|
11
13
|
static get styles() {
|
|
12
14
|
return [
|
|
13
15
|
css`
|
|
@@ -31,12 +33,8 @@ class WeeklyReportCalendar extends connect(store)(PageView) {
|
|
|
31
33
|
]
|
|
32
34
|
}
|
|
33
35
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
itemId: String,
|
|
37
|
-
params: Object
|
|
38
|
-
}
|
|
39
|
-
}
|
|
36
|
+
@property({ type: String }) itemId = ''
|
|
37
|
+
@property({ type: Object }) params = {}
|
|
40
38
|
|
|
41
39
|
render() {
|
|
42
40
|
return html`
|
|
@@ -127,5 +125,3 @@ class WeeklyReportCalendar extends connect(store)(PageView) {
|
|
|
127
125
|
*/
|
|
128
126
|
}
|
|
129
127
|
}
|
|
130
|
-
|
|
131
|
-
customElements.define('weekly-report-calendar-page', WeeklyReportCalendar)
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import './weekly-report-preview-popup'
|
|
2
2
|
|
|
3
3
|
import gql from 'graphql-tag'
|
|
4
|
-
import { css, html } from 'lit
|
|
4
|
+
import { css, html } from 'lit'
|
|
5
|
+
import { customElement, property, query } from 'lit/decorators.js'
|
|
5
6
|
import { connect } from 'pwa-helpers/connect-mixin.js'
|
|
6
7
|
|
|
8
|
+
import { client, gqlContext } from '@operato/graphql'
|
|
7
9
|
import { i18next } from '@operato/i18n'
|
|
8
10
|
import { openPopup } from '@operato/layout'
|
|
9
|
-
import {
|
|
11
|
+
import { PageView, store } from '@operato/shell'
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
@customElement('weekly-report-editor-page')
|
|
14
|
+
export class WeeklyReportEditor extends connect(store)(PageView) {
|
|
12
15
|
static get styles() {
|
|
13
16
|
return [
|
|
14
17
|
css`
|
|
@@ -30,12 +33,13 @@ class WeeklyReportEditor extends connect(store)(PageView) {
|
|
|
30
33
|
]
|
|
31
34
|
}
|
|
32
35
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
@property({ type: String }) itemId = ''
|
|
37
|
+
@property({ type: Object }) params = {}
|
|
38
|
+
|
|
39
|
+
@query(`[name="this-week-report"]`) thisWeekReportElement
|
|
40
|
+
@query(`[name="next-week-report"]`) nextWeekReportElement
|
|
41
|
+
@query(`[name="issue-report"]`) issueReportElement
|
|
42
|
+
@query(`[name="other-report"]`) otherReportElement
|
|
39
43
|
|
|
40
44
|
render() {
|
|
41
45
|
return html`
|
|
@@ -97,13 +101,13 @@ class WeeklyReportEditor extends connect(store)(PageView) {
|
|
|
97
101
|
`
|
|
98
102
|
}
|
|
99
103
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
get reports() {
|
|
105
|
+
return {
|
|
106
|
+
thisWeekReport: this.thisWeekReportElement.value,
|
|
107
|
+
nextWeekReport: this.nextWeekReportElement.value,
|
|
108
|
+
issueReport: this.issueReportElement.value,
|
|
109
|
+
otherReport: this.otherReportElement.value
|
|
110
|
+
}
|
|
107
111
|
}
|
|
108
112
|
|
|
109
113
|
// test event handler
|
|
@@ -111,11 +115,12 @@ class WeeklyReportEditor extends connect(store)(PageView) {
|
|
|
111
115
|
// const [receivers, title, body, image, url] = ['receivers', 'title', 'body', 'image', 'url'].map(
|
|
112
116
|
// key => this.renderRoot.querySelector(`[name="${key}"]`).value
|
|
113
117
|
// )
|
|
114
|
-
|
|
118
|
+
const { thisWeekReport } = this.reports
|
|
119
|
+
console.log(thisWeekReport)
|
|
115
120
|
}
|
|
116
121
|
|
|
117
122
|
onpreview() {
|
|
118
|
-
const { thisWeekReport, nextWeekReport, issueReport, otherReport } = this.
|
|
123
|
+
const { thisWeekReport, nextWeekReport, issueReport, otherReport } = this.reports
|
|
119
124
|
|
|
120
125
|
const popup = openPopup(
|
|
121
126
|
html`
|
|
@@ -146,7 +151,7 @@ class WeeklyReportEditor extends connect(store)(PageView) {
|
|
|
146
151
|
|
|
147
152
|
// test code
|
|
148
153
|
const weeks = 10
|
|
149
|
-
const { thisWeekReport, nextWeekReport, issueReport, otherReport } = this.
|
|
154
|
+
const { thisWeekReport, nextWeekReport, issueReport, otherReport } = this.reports
|
|
150
155
|
|
|
151
156
|
const response = await client.mutate({
|
|
152
157
|
mutation: gql`
|
|
@@ -228,7 +233,7 @@ class WeeklyReportEditor extends connect(store)(PageView) {
|
|
|
228
233
|
|
|
229
234
|
// add an event for the shortcut of 'save'
|
|
230
235
|
window.addEventListener('keydown', e => {
|
|
231
|
-
if (
|
|
236
|
+
if (e.key === 's' && (e.metaKey || e.ctrlKey)) {
|
|
232
237
|
e.preventDefault()
|
|
233
238
|
this.onsave()
|
|
234
239
|
}
|
|
@@ -276,16 +281,13 @@ class WeeklyReportEditor extends connect(store)(PageView) {
|
|
|
276
281
|
})
|
|
277
282
|
|
|
278
283
|
if (response.errors) {
|
|
279
|
-
this.
|
|
284
|
+
this.thisWeekReportElement.value = reportTemplate
|
|
280
285
|
} else {
|
|
281
|
-
this.
|
|
282
|
-
|
|
283
|
-
this.renderRoot.querySelector(`[name="next-week-report"]`).value =
|
|
284
|
-
response.data.weeklyReportByWeeks.nextWeekReport
|
|
285
|
-
|
|
286
|
+
this.thisWeekReportElement.value = response.data.weeklyReportByWeeks.thisWeekReport
|
|
287
|
+
this.nextWeekReportElement.value = response.data.weeklyReportByWeeks.nextWeekReport
|
|
286
288
|
console.log('xxxx: ', response.data.weeklyReportByWeeks)
|
|
287
|
-
this.
|
|
288
|
-
this.
|
|
289
|
+
this.issueReportElement.value = response.data.weeklyReportByWeeks.issueReport
|
|
290
|
+
this.otherReportElement.value = response.data.weeklyReportByWeeks.otherReport
|
|
289
291
|
}
|
|
290
292
|
|
|
291
293
|
this.itemId = lifecycle.resourceId
|
|
@@ -307,5 +309,3 @@ class WeeklyReportEditor extends connect(store)(PageView) {
|
|
|
307
309
|
*/
|
|
308
310
|
}
|
|
309
311
|
}
|
|
310
|
-
|
|
311
|
-
customElements.define('weekly-report-editor-page', WeeklyReportEditor)
|
|
@@ -1,32 +1,14 @@
|
|
|
1
1
|
import { css, html, LitElement } from 'lit'
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js'
|
|
2
3
|
import { unsafeHTML } from 'lit/directives/unsafe-html.js'
|
|
3
4
|
import { marked } from 'marked'
|
|
4
5
|
|
|
6
|
+
@customElement('weekly-report-preview-popup')
|
|
5
7
|
export class WeeklyReportPreviewPopup extends LitElement {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
attribute: 'this-week'
|
|
11
|
-
},
|
|
12
|
-
nextWeekReport: {
|
|
13
|
-
type: String,
|
|
14
|
-
attribute: 'next-week'
|
|
15
|
-
},
|
|
16
|
-
issueReport: {
|
|
17
|
-
type: String,
|
|
18
|
-
attribute: 'issue'
|
|
19
|
-
},
|
|
20
|
-
otherReport: {
|
|
21
|
-
type: String,
|
|
22
|
-
attribute: 'other'
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
constructor() {
|
|
28
|
-
super()
|
|
29
|
-
}
|
|
8
|
+
@property({ type: String, attribute: 'this-week' }) thisWeekReport = ''
|
|
9
|
+
@property({ type: String, attribute: 'next-week' }) nextWeekReport = ''
|
|
10
|
+
@property({ type: String, attribute: 'issue' }) issueReport = ''
|
|
11
|
+
@property({ type: String, attribute: 'other' }) otherReport = ''
|
|
30
12
|
|
|
31
13
|
static get styles() {
|
|
32
14
|
return [
|
|
@@ -94,5 +76,3 @@ export class WeeklyReportPreviewPopup extends LitElement {
|
|
|
94
76
|
this.dispatchEvent(new CustomEvent('imported'))
|
|
95
77
|
}
|
|
96
78
|
}
|
|
97
|
-
|
|
98
|
-
window.customElements.define('weekly-report-preview-popup', WeeklyReportPreviewPopup)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export default function route(page) {
|
|
1
|
+
export default function route(page: string) {
|
|
2
2
|
switch (page) {
|
|
3
3
|
case '':
|
|
4
4
|
return '/todo-list'
|
|
@@ -8,15 +8,15 @@ export default function route(page) {
|
|
|
8
8
|
return page
|
|
9
9
|
|
|
10
10
|
case 'weekly-report-list':
|
|
11
|
-
import('./pages/weekly-report/weekly-report-list-page
|
|
11
|
+
import('./pages/weekly-report/weekly-report-list-page')
|
|
12
12
|
return page
|
|
13
13
|
|
|
14
14
|
case 'weekly-report-calendar':
|
|
15
|
-
import('./pages/weekly-report-calendar
|
|
15
|
+
import('./pages/weekly-report-calendar')
|
|
16
16
|
return page
|
|
17
17
|
|
|
18
18
|
case 'weekly-report-editor':
|
|
19
|
-
import('./pages/weekly-report-editor
|
|
19
|
+
import('./pages/weekly-report-editor')
|
|
20
20
|
return page
|
|
21
21
|
}
|
|
22
22
|
}
|
package/db.sqlite
CHANGED
|
Binary file
|
|
@@ -15,7 +15,7 @@ let WeeklyReportMutation = class WeeklyReportMutation {
|
|
|
15
15
|
const { domain, user, tx } = context.state;
|
|
16
16
|
const repository = tx.getRepository(weekly_report_1.WeeklyReport);
|
|
17
17
|
const foundReport = await repository.findOne({
|
|
18
|
-
where: { domain, reportOwner: user, weeks: weeklyReport.weeks }
|
|
18
|
+
where: { domain: { id: domain.id }, reportOwner: { id: user.id }, weeks: weeklyReport.weeks }
|
|
19
19
|
});
|
|
20
20
|
if (foundReport && foundReport.id) {
|
|
21
21
|
console.log('update: ', Object.assign(Object.assign({ id: foundReport.id }, weeklyReport), { updater: user }));
|
|
@@ -37,7 +37,7 @@ let WeeklyReportMutation = class WeeklyReportMutation {
|
|
|
37
37
|
const { domain, user, tx } = context.state;
|
|
38
38
|
const repository = tx.getRepository(weekly_report_1.WeeklyReport);
|
|
39
39
|
const weeklyReport = await repository.findOne({
|
|
40
|
-
where: { domain, id }
|
|
40
|
+
where: { domain: { id: domain.id }, id }
|
|
41
41
|
});
|
|
42
42
|
return await repository.save(Object.assign(Object.assign(Object.assign({}, weeklyReport), patch), { updater: user }));
|
|
43
43
|
}
|
|
@@ -57,7 +57,7 @@ let WeeklyReportMutation = class WeeklyReportMutation {
|
|
|
57
57
|
if (_updateRecords.length > 0) {
|
|
58
58
|
for (let i = 0; i < _updateRecords.length; i++) {
|
|
59
59
|
const newRecord = _updateRecords[i];
|
|
60
|
-
const weeklyReport = await weeklyReportRepo.
|
|
60
|
+
const weeklyReport = await weeklyReportRepo.findOneBy({ id: newRecord.id });
|
|
61
61
|
const result = await weeklyReportRepo.save(Object.assign(Object.assign(Object.assign({}, weeklyReport), newRecord), { updater: user }));
|
|
62
62
|
results.push(Object.assign(Object.assign({}, result), { cuFlag: 'M' }));
|
|
63
63
|
}
|
|
@@ -66,13 +66,13 @@ let WeeklyReportMutation = class WeeklyReportMutation {
|
|
|
66
66
|
}
|
|
67
67
|
async deleteWeeklyReport(id, context) {
|
|
68
68
|
const { domain, tx } = context.state;
|
|
69
|
-
await tx.getRepository(weekly_report_1.WeeklyReport).delete({ domain, id });
|
|
69
|
+
await tx.getRepository(weekly_report_1.WeeklyReport).delete({ domain: { id: domain.id }, id });
|
|
70
70
|
return true;
|
|
71
71
|
}
|
|
72
72
|
async deleteWeeklyReports(ids, context) {
|
|
73
73
|
const { domain, tx } = context.state;
|
|
74
74
|
await tx.getRepository(weekly_report_1.WeeklyReport).delete({
|
|
75
|
-
domain,
|
|
75
|
+
domain: { id: domain.id },
|
|
76
76
|
id: (0, typeorm_1.In)(ids)
|
|
77
77
|
});
|
|
78
78
|
return true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"weekly-report-mutation.js","sourceRoot":"","sources":["../../../server/service/weekly-report/weekly-report-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAI5B,mDAA8C;AAC9C,6DAAyE;AAGzE,IAA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iB,CAAC,CAAC,CAAA;IACjD,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;+DAWP;AA1KU,oBAAoB;IADhC,IAAA,uBAAQ,EAAC,4BAAY,CAAC;GACV,oBAAoB,CA2KhC;AA3KY,oDAAoB","sourcesContent":["import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { sleep } from '@things-factory/utils'\n\nimport { WeeklyReport } from './weekly-report'\nimport { NewWeeklyReport, WeeklyReportPatch } from './weekly-report-type'\n\n@Resolver(WeeklyReport)\nexport class WeeklyReportMutation {\n @Directive('@transaction')\n @Mutation(returns => WeeklyReport, { description: 'To create new WeeklyReport' })\n async createWeeklyReport(\n @Arg('weeklyReport') weeklyReport: NewWeeklyReport,\n @Ctx() context: any\n ): Promise<WeeklyReport> {\n const { domain, user, tx } = context.state\n\n return await tx.getRepository(WeeklyReport).save({\n ...weeklyReport,\n domain,\n reportOwner: user,\n creator: user,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => WeeklyReport, { description: 'To save a WeeklyReport' })\n async saveWeeklyReport(\n @Arg('weeklyReport') weeklyReport: NewWeeklyReport,\n @Ctx() context: any\n ): Promise<WeeklyReport> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(WeeklyReport)\n\n const foundReport = await repository.findOne({\n where: { domain, reportOwner: user, weeks: weeklyReport.weeks }\n })\n\n if (foundReport && foundReport.id) {\n console.log('update: ', {\n id: foundReport.id,\n ...weeklyReport,\n updater: user\n })\n\n return await repository.save({\n id: foundReport.id,\n ...weeklyReport,\n updater: user\n })\n } else {\n return await tx.getRepository(WeeklyReport).save({\n ...weeklyReport,\n domain,\n reportOwner: user,\n creator: user,\n updater: user\n })\n }\n\n return foundReport\n\n // return await tx.getRepository(WeeklyReport).save({\n // ...weeklyReport,\n // domain,\n // reportOwner: user,\n // creator: user,\n // updater: user\n // })\n }\n\n @Directive('@transaction')\n @Mutation(returns => WeeklyReport, { description: 'To modify WeeklyReport information' })\n async updateWeeklyReport(\n @Arg('id') id: string,\n @Arg('patch') patch: WeeklyReportPatch,\n @Ctx() context: any\n ): Promise<WeeklyReport> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(WeeklyReport)\n const weeklyReport = await repository.findOne({\n where: { domain, id }\n })\n\n return await repository.save({\n ...weeklyReport,\n ...patch,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => [WeeklyReport], { description: \"To modify multiple WeeklyReports' information\" })\n async updateMultipleWeeklyReport(\n @Arg('patches', type => [WeeklyReportPatch]) patches: WeeklyReportPatch[],\n @Ctx() context: any\n ): Promise<WeeklyReport[]> {\n const { domain, user, tx } = context.state\n\n let results = []\n const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')\n const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')\n const weeklyReportRepo = tx.getRepository(WeeklyReport)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n const result = await weeklyReportRepo.save({\n ...newRecord,\n domain,\n reportOwner: user,\n creator: user,\n updater: user\n })\n\n results.push({ ...result, cuFlag: '+' })\n }\n }\n\n if (_updateRecords.length > 0) {\n for (let i = 0; i < _updateRecords.length; i++) {\n const newRecord = _updateRecords[i]\n const weeklyReport = await weeklyReportRepo.findOne(newRecord.id)\n\n const result = await weeklyReportRepo.save({\n ...weeklyReport,\n ...newRecord,\n updater: user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete WeeklyReport' })\n async deleteWeeklyReport(@Arg('id') id: string, @Ctx() context: any): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(WeeklyReport).delete({ domain, id })\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple WeeklyReports' })\n async deleteWeeklyReports(@Arg('ids', type => [String]) ids: string[], @Ctx() context: any): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(WeeklyReport).delete({\n domain,\n id: In(ids)\n })\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To import multiple WeeklyReports' })\n async importWeeklyReports(\n @Arg('weeklyReports', type => [WeeklyReportPatch]) weeklyReports: WeeklyReportPatch[],\n @Ctx() context: any\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n weeklyReports.map(async (weeklyReport: WeeklyReportPatch) => {\n const createdWeeklyReport: WeeklyReport = await tx.getRepository(WeeklyReport).save({ domain, ...weeklyReport })\n })\n )\n\n return true\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"weekly-report-mutation.js","sourceRoot":"","sources":["../../../server/service/weekly-report/weekly-report-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAA4B;AAE5B,mDAA8C;AAC9C,6DAAyE;AAGzE,IAAa,oBAAoB,GAAjC,MAAa,oBAAoB;IAG/B,KAAK,CAAC,kBAAkB,CACD,YAA6B,EAC3C,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,OAAO,MAAM,EAAE,CAAC,aAAa,CAAC,4BAAY,CAAC,CAAC,IAAI,iCAC3C,YAAY,KACf,MAAM,EACN,WAAW,EAAE,IAAI,EACjB,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,IACb,CAAA;IACJ,CAAC;IAID,KAAK,CAAC,gBAAgB,CACC,YAA6B,EAC3C,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,MAAM,UAAU,GAAG,EAAE,CAAC,aAAa,CAAC,4BAAY,CAAC,CAAA;QAEjD,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC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EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,sCAAiB,CAAC,CAAC,CAAA;IAC3C,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;sEAyCP;AAID;IAFC,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,wBAAwB,EAAE,CAAC;IAC9C,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;8DAKrD;AAID;IAFC,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;IAE/E,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;+DAUP;AAID;IAFC,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;IAE/E,mBAAA,IAAA,kBAAG,EAAC,eAAe,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,sCAAiB,CAAC,CAAC,CAAA;IACjD,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;+DAWP;AA7KU,oBAAoB;IADhC,IAAA,uBAAQ,EAAC,4BAAY,CAAC;GACV,oBAAoB,CA8KhC;AA9KY,oDAAoB","sourcesContent":["import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'\nimport { In } from 'typeorm'\n\nimport { WeeklyReport } from './weekly-report'\nimport { NewWeeklyReport, WeeklyReportPatch } from './weekly-report-type'\n\n@Resolver(WeeklyReport)\nexport class WeeklyReportMutation {\n @Directive('@transaction')\n @Mutation(returns => WeeklyReport, { description: 'To create new WeeklyReport' })\n async createWeeklyReport(\n @Arg('weeklyReport') weeklyReport: NewWeeklyReport,\n @Ctx() context: ResolverContext\n ): Promise<WeeklyReport> {\n const { domain, user, tx } = context.state\n\n return await tx.getRepository(WeeklyReport).save({\n ...weeklyReport,\n domain,\n reportOwner: user,\n creator: user,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => WeeklyReport, { description: 'To save a WeeklyReport' })\n async saveWeeklyReport(\n @Arg('weeklyReport') weeklyReport: NewWeeklyReport,\n @Ctx() context: ResolverContext\n ): Promise<WeeklyReport> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(WeeklyReport)\n\n const foundReport = await repository.findOne({\n where: { domain: { id: domain.id }, reportOwner: { id: user.id }, weeks: weeklyReport.weeks }\n })\n\n if (foundReport && foundReport.id) {\n console.log('update: ', {\n id: foundReport.id,\n ...weeklyReport,\n updater: user\n })\n\n return await repository.save({\n id: foundReport.id,\n ...weeklyReport,\n updater: user\n })\n } else {\n return await tx.getRepository(WeeklyReport).save({\n ...weeklyReport,\n domain,\n reportOwner: user,\n creator: user,\n updater: user\n })\n }\n\n return foundReport\n\n // return await tx.getRepository(WeeklyReport).save({\n // ...weeklyReport,\n // domain,\n // reportOwner: user,\n // creator: user,\n // updater: user\n // })\n }\n\n @Directive('@transaction')\n @Mutation(returns => WeeklyReport, { description: 'To modify WeeklyReport information' })\n async updateWeeklyReport(\n @Arg('id') id: string,\n @Arg('patch') patch: WeeklyReportPatch,\n @Ctx() context: ResolverContext\n ): Promise<WeeklyReport> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(WeeklyReport)\n const weeklyReport = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n return await repository.save({\n ...weeklyReport,\n ...patch,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => [WeeklyReport], { description: \"To modify multiple WeeklyReports' information\" })\n async updateMultipleWeeklyReport(\n @Arg('patches', type => [WeeklyReportPatch]) patches: WeeklyReportPatch[],\n @Ctx() context: ResolverContext\n ): Promise<WeeklyReport[]> {\n const { domain, user, tx } = context.state\n\n let results = []\n const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')\n const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')\n const weeklyReportRepo = tx.getRepository(WeeklyReport)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n const result = await weeklyReportRepo.save({\n ...newRecord,\n domain,\n reportOwner: user,\n creator: user,\n updater: user\n })\n\n results.push({ ...result, cuFlag: '+' })\n }\n }\n\n if (_updateRecords.length > 0) {\n for (let i = 0; i < _updateRecords.length; i++) {\n const newRecord = _updateRecords[i]\n const weeklyReport = await weeklyReportRepo.findOneBy({ id: newRecord.id })\n\n const result = await weeklyReportRepo.save({\n ...weeklyReport,\n ...newRecord,\n updater: user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete WeeklyReport' })\n async deleteWeeklyReport(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(WeeklyReport).delete({ domain: { id: domain.id }, id })\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple WeeklyReports' })\n async deleteWeeklyReports(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(WeeklyReport).delete({\n domain: { id: domain.id },\n id: In(ids)\n })\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To import multiple WeeklyReports' })\n async importWeeklyReports(\n @Arg('weeklyReports', type => [WeeklyReportPatch]) weeklyReports: WeeklyReportPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await Promise.all(\n weeklyReports.map(async (weeklyReport: WeeklyReportPatch) => {\n const createdWeeklyReport: WeeklyReport = await tx.getRepository(WeeklyReport).save({ domain, ...weeklyReport })\n })\n )\n\n return true\n }\n}\n"]}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.WeeklyReportQuery = void 0;
|
|
5
4
|
const tslib_1 = require("tslib");
|
|
6
5
|
const type_graphql_1 = require("type-graphql");
|
|
7
|
-
const typeorm_1 = require("typeorm");
|
|
8
6
|
const auth_base_1 = require("@things-factory/auth-base");
|
|
9
7
|
const shell_1 = require("@things-factory/shell");
|
|
10
8
|
const weekly_report_1 = require("./weekly-report");
|
|
@@ -12,33 +10,33 @@ const weekly_report_type_1 = require("./weekly-report-type");
|
|
|
12
10
|
let WeeklyReportQuery = class WeeklyReportQuery {
|
|
13
11
|
async weeklyReport(id, context) {
|
|
14
12
|
const { domain, user } = context.state;
|
|
15
|
-
return await (0,
|
|
16
|
-
where: { domain, id, reportOwner: user }
|
|
13
|
+
return await (0, shell_1.getRepository)(weekly_report_1.WeeklyReport).findOne({
|
|
14
|
+
where: { domain: { id: domain.id }, id, reportOwner: { id: user.id } }
|
|
17
15
|
});
|
|
18
16
|
}
|
|
19
17
|
async weeklyReports(params, context) {
|
|
20
18
|
const { domain } = context.state;
|
|
21
19
|
const convertedParams = (0, shell_1.convertListParams)(params, { domain, searchables: ['reportOwner', 'weeks'] });
|
|
22
|
-
const [items, total] = await (0,
|
|
20
|
+
const [items, total] = await (0, shell_1.getRepository)(weekly_report_1.WeeklyReport).findAndCount(convertedParams);
|
|
23
21
|
return { items, total };
|
|
24
22
|
}
|
|
25
23
|
async weeklyReportByWeeks(weeks, context) {
|
|
26
24
|
const { domain, user } = context.state;
|
|
27
|
-
return await (0,
|
|
28
|
-
where: { domain, reportOwner: user, weeks }
|
|
25
|
+
return await (0, shell_1.getRepository)(weekly_report_1.WeeklyReport).findOne({
|
|
26
|
+
where: { domain: { id: domain.id }, reportOwner: { id: user.id }, weeks }
|
|
29
27
|
});
|
|
30
28
|
}
|
|
31
29
|
async domain(weeklyReport) {
|
|
32
|
-
return await (0,
|
|
30
|
+
return await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: weeklyReport.domainId });
|
|
33
31
|
}
|
|
34
32
|
async reportOwner(weeklyReport) {
|
|
35
|
-
return await (0,
|
|
33
|
+
return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: weeklyReport.reportOwnerId });
|
|
36
34
|
}
|
|
37
35
|
async updater(weeklyReport) {
|
|
38
|
-
return await (0,
|
|
36
|
+
return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: weeklyReport.updaterId });
|
|
39
37
|
}
|
|
40
38
|
async creator(weeklyReport) {
|
|
41
|
-
return await (0,
|
|
39
|
+
return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: weeklyReport.creatorId });
|
|
42
40
|
}
|
|
43
41
|
};
|
|
44
42
|
tslib_1.__decorate([
|
|
@@ -54,7 +52,7 @@ tslib_1.__decorate([
|
|
|
54
52
|
tslib_1.__param(0, (0, type_graphql_1.Args)()),
|
|
55
53
|
tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
|
|
56
54
|
tslib_1.__metadata("design:type", Function),
|
|
57
|
-
tslib_1.__metadata("design:paramtypes", [
|
|
55
|
+
tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
|
|
58
56
|
tslib_1.__metadata("design:returntype", Promise)
|
|
59
57
|
], WeeklyReportQuery.prototype, "weeklyReports", null);
|
|
60
58
|
tslib_1.__decorate([
|