Skip to content

Commit 3537d19

Browse files
authored
fix: removes object property from list (#733)
1 parent b2010ae commit 3537d19

8 files changed

+22
-15
lines changed

src/common/utils/parse-contact-properties-to-api-options.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export function parseContactPropertyFromApi(
1717
return {
1818
id: contactProperty.id,
1919
key: contactProperty.key,
20-
object: contactProperty.object,
2120
createdAt: contactProperty.created_at,
2221
type: contactProperty.type,
2322
fallbackValue: contactProperty.fallback_value,

src/contact-properties/contact-properties.spec.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,13 @@ describe('ContactProperties', () => {
9797
key: 'country',
9898
type: 'string',
9999
fallback_value: 'unknown',
100-
object: 'contact_property',
101100
created_at: '2021-01-01T00:00:00.000Z',
102101
},
103102
{
104103
id: 'ac7503ac-e027-4aea-94b3-b0acd46f65f9',
105104
key: 'edition',
106105
type: 'number',
107106
fallback_value: 1,
108-
object: 'contact_property',
109107
created_at: '2021-01-01T00:00:00.000Z',
110108
},
111109
],
@@ -127,15 +125,13 @@ describe('ContactProperties', () => {
127125
"fallbackValue": "unknown",
128126
"id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e",
129127
"key": "country",
130-
"object": "contact_property",
131128
"type": "string",
132129
},
133130
{
134131
"createdAt": "2021-01-01T00:00:00.000Z",
135132
"fallbackValue": 1,
136133
"id": "ac7503ac-e027-4aea-94b3-b0acd46f65f9",
137134
"key": "edition",
138-
"object": "contact_property",
139135
"type": "number",
140136
},
141137
],

src/contact-properties/contact-properties.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,10 @@ export class ContactProperties {
8787

8888
if (response.data) {
8989
return {
90-
data: parseContactPropertyFromApi(response.data),
90+
data: {
91+
object: 'contact_property',
92+
...parseContactPropertyFromApi(response.data),
93+
},
9194
headers: response.headers,
9295
error: null,
9396
};

src/contact-properties/interfaces/contact-property.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ type NumberBaseApiContactProperty = {
1111

1212
export type ApiContactProperty = {
1313
id: string;
14-
object: 'contact_property';
1514
created_at: string;
1615
key: string;
1716
} & (StringBaseApiContactProperty | NumberBaseApiContactProperty);
@@ -29,7 +28,6 @@ type NumberBaseContactProperty = {
2928

3029
export type ContactProperty = {
3130
id: string;
32-
object: 'contact_property';
3331
createdAt: string;
3432
key: string;
3533
} & (StringBaseContactProperty | NumberBaseContactProperty);

src/contact-properties/interfaces/create-contact-property-options.interface.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ export interface CreateContactPropertyApiOptions {
2525

2626
export type CreateContactPropertyResponseSuccess = Pick<
2727
ContactProperty,
28-
'id' | 'object'
29-
>;
28+
'id'
29+
> & {
30+
object: 'contact_property';
31+
};
3032

3133
export type CreateContactPropertyResponse =
3234
Response<CreateContactPropertyResponseSuccess>;

src/contact-properties/interfaces/delete-contact-property-options.interface.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ import type { ContactProperty } from './contact-property';
33

44
export type RemoveContactPropertyResponseSuccess = Pick<
55
ContactProperty,
6-
'id' | 'object'
6+
'id'
77
> & {
8+
object: 'contact_property';
89
deleted: boolean;
910
};
1011

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import type { Response } from '../../interfaces';
22
import type { ApiContactProperty, ContactProperty } from './contact-property';
33

4-
export type GetContactPropertyResponseSuccess = ApiContactProperty;
4+
export type GetContactPropertyResponseSuccess = ApiContactProperty & {
5+
object: 'contact_property';
6+
};
57

6-
export type GetContactPropertyResponse = Response<ContactProperty>;
8+
export type GetContactPropertyResponse = Response<
9+
ContactProperty & {
10+
object: 'contact_property';
11+
}
12+
>;

src/contact-properties/interfaces/update-contact-property-options.interface.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ export interface UpdateContactPropertyApiOptions {
1414

1515
export type UpdateContactPropertyResponseSuccess = Pick<
1616
ContactProperty,
17-
'id' | 'object'
18-
>;
17+
'id'
18+
> & {
19+
object: 'contact_property';
20+
};
1921

2022
export type UpdateContactPropertyResponse =
2123
Response<UpdateContactPropertyResponseSuccess>;

0 commit comments

Comments
 (0)