From 8e47190cf75b373755dd8c1ed263353befa2bd14 Mon Sep 17 00:00:00 2001 From: "Serge R. Kamel" Date: Fri, 19 Oct 2018 11:32:57 +0300 Subject: [PATCH 1/3] ZX-320 feat: return the ID of the created appointment on creation. --- package-lock.json | 28 +++++++++++++++++++++------- src/batch-client/index.ts | 2 +- src/schema/generated-schema-types.ts | 7 ++++++- src/schema/schema.graphql | 7 ++++++- 4 files changed, 34 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index ed399f8ca..2074400b6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3838,12 +3838,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -3858,17 +3860,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -3985,7 +3990,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -3997,6 +4003,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -4011,6 +4018,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -4018,12 +4026,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.2.4", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -4042,6 +4052,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -4122,7 +4133,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -4134,6 +4146,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -4255,6 +4268,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", diff --git a/src/batch-client/index.ts b/src/batch-client/index.ts index 21e584abe..01a70c2ec 100644 --- a/src/batch-client/index.ts +++ b/src/batch-client/index.ts @@ -241,7 +241,7 @@ export class ZimbraBatchClient { ...denormalize(CalendarItemCreateModifyRequest)(appointment) }, accountName: accountName - }); + }).then(({ invId }) => ({ inviteId: invId, created: !!invId })); public createAppointmentException = ( accountName: string, diff --git a/src/schema/generated-schema-types.ts b/src/schema/generated-schema-types.ts index 55830bfc5..1ff1bd1e0 100644 --- a/src/schema/generated-schema-types.ts +++ b/src/schema/generated-schema-types.ts @@ -991,7 +991,7 @@ export interface Mutation { checkCalendar?: boolean | null; contactAction?: ActionOpResponse | null; conversationAction?: boolean | null; - createAppointment?: boolean | null; + createAppointment?: createAppointmentResponse | null; createAppointmentException?: boolean | null; createCalendar?: boolean | null; createContact?: Contact | null; @@ -1057,6 +1057,11 @@ export interface ActionOpResponseData { op: string; } +export interface createAppointmentResponse { + created?: boolean | null; + inviteId?: string | null; +} + export interface SignatureResponse { signature?: NameId[] | null; } diff --git a/src/schema/schema.graphql b/src/schema/schema.graphql index 122eb4bf8..c1d757914 100644 --- a/src/schema/schema.graphql +++ b/src/schema/schema.graphql @@ -2010,6 +2010,11 @@ type SMimeMessage { content: String } +type createAppointmentResponse { + created: Boolean + inviteId: String +} + ##### End Of SMIME Certificates type ##### type ActionOpResponseData { @@ -2159,7 +2164,7 @@ type Mutation { ids: [ID!]! op: String! ): Boolean - createAppointment(accountName: String, appointment: CalendarItemInput!): Boolean + createAppointment(accountName: String, appointment: CalendarItemInput!): createAppointmentResponse createAppointmentException(accountName: String, appointment: CalendarItemInput!): Boolean createCalendar(name: String!, color: Int!, url: String): Boolean createContact(contact: CreateContactInput!): Contact From 0e15ae2d35531d7b2d474bc5fcbe0920d90a14b6 Mon Sep 17 00:00:00 2001 From: "Serge R. Kamel" Date: Fri, 19 Oct 2018 18:47:20 +0300 Subject: [PATCH 2/3] ZX-320 fix: use existing graphql response type. --- src/batch-client/index.ts | 2 +- src/schema/generated-schema-types.ts | 7 +------ src/schema/schema.graphql | 7 +------ 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/batch-client/index.ts b/src/batch-client/index.ts index 01a70c2ec..2886adc1f 100644 --- a/src/batch-client/index.ts +++ b/src/batch-client/index.ts @@ -241,7 +241,7 @@ export class ZimbraBatchClient { ...denormalize(CalendarItemCreateModifyRequest)(appointment) }, accountName: accountName - }).then(({ invId }) => ({ inviteId: invId, created: !!invId })); + }).then(({ invId }) => ({ inviteId: invId })); public createAppointmentException = ( accountName: string, diff --git a/src/schema/generated-schema-types.ts b/src/schema/generated-schema-types.ts index 1ff1bd1e0..098c5ac13 100644 --- a/src/schema/generated-schema-types.ts +++ b/src/schema/generated-schema-types.ts @@ -991,7 +991,7 @@ export interface Mutation { checkCalendar?: boolean | null; contactAction?: ActionOpResponse | null; conversationAction?: boolean | null; - createAppointment?: createAppointmentResponse | null; + createAppointment?: CalendarItemHitInfo | null; createAppointmentException?: boolean | null; createCalendar?: boolean | null; createContact?: Contact | null; @@ -1057,11 +1057,6 @@ export interface ActionOpResponseData { op: string; } -export interface createAppointmentResponse { - created?: boolean | null; - inviteId?: string | null; -} - export interface SignatureResponse { signature?: NameId[] | null; } diff --git a/src/schema/schema.graphql b/src/schema/schema.graphql index c1d757914..47849d91c 100644 --- a/src/schema/schema.graphql +++ b/src/schema/schema.graphql @@ -2010,11 +2010,6 @@ type SMimeMessage { content: String } -type createAppointmentResponse { - created: Boolean - inviteId: String -} - ##### End Of SMIME Certificates type ##### type ActionOpResponseData { @@ -2164,7 +2159,7 @@ type Mutation { ids: [ID!]! op: String! ): Boolean - createAppointment(accountName: String, appointment: CalendarItemInput!): createAppointmentResponse + createAppointment(accountName: String, appointment: CalendarItemInput!): CalendarItemHitInfo createAppointmentException(accountName: String, appointment: CalendarItemInput!): Boolean createCalendar(name: String!, color: Int!, url: String): Boolean createContact(contact: CreateContactInput!): Contact From 32ec79dc28845d5c9bc4237d2a988d8ef6f15d2e Mon Sep 17 00:00:00 2001 From: "Serge R. Kamel" Date: Thu, 25 Oct 2018 09:52:12 +0300 Subject: [PATCH 3/3] ZX-320 feat: return the whole calendarItemHitInfo obj. --- src/batch-client/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/batch-client/index.ts b/src/batch-client/index.ts index 2886adc1f..da9b0a561 100644 --- a/src/batch-client/index.ts +++ b/src/batch-client/index.ts @@ -241,7 +241,7 @@ export class ZimbraBatchClient { ...denormalize(CalendarItemCreateModifyRequest)(appointment) }, accountName: accountName - }).then(({ invId }) => ({ inviteId: invId })); + }).then(res => normalize(CalendarItemHitInfo)(res)); public createAppointmentException = ( accountName: string,