Skip to content

Commit b2772e3

Browse files
committed
MINOR: Feature: Model Transform (#786)
* MINOR: feat(model): add models transform * fix: set transform read_only=True * fix(transform): use 'prefetch_related' instead of 'select_related' for transform in model qs * fix(transform): use select_related and fix model_list tests
1 parent ae02b2e commit b2772e3

27 files changed

+395
-177
lines changed

package/.openapi-generator/FILES

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ src/models/PatchedTagRequest.ts
132132
src/models/PatchedTopicRequest.ts
133133
src/models/PatchedTopicStatusRequest.ts
134134
src/models/PatchedTopicTypeRequest.ts
135+
src/models/PatchedTransformRequest.ts
135136
src/models/PatchedUnitRequest.ts
136137
src/models/PatchedUserCloudUpdateRequest.ts
137138
src/models/PatchedUserProjectUpdateRequest.ts
@@ -223,6 +224,8 @@ src/models/TopicStatus.ts
223224
src/models/TopicStatusRequest.ts
224225
src/models/TopicType.ts
225226
src/models/TopicTypeRequest.ts
227+
src/models/Transform.ts
228+
src/models/TransformRequest.ts
226229
src/models/Unit.ts
227230
src/models/UnitRequest.ts
228231
src/models/User.ts

package/src/apis/CollaborationApi.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,7 +1671,7 @@ export class CollaborationApi extends runtime.BaseAPI {
16711671
}
16721672

16731673
/**
1674-
* Create a document. If the document is one of {\'DWG\', \'POINT_CLOUD\', \'IFC\', \'DXF\', \'OBJ\', \'GLTF\'}, a model will be created and attached to this document Required scopes: document:write
1674+
* Create a document. If the document is one of {\'POINT_CLOUD\', \'DWG\', \'OBJ\', \'DXF\', \'IFC\', \'GLTF\'}, a model will be created and attached to this document Required scopes: document:write
16751675
* Create a document
16761676
*/
16771677
async createDocumentRaw(requestParameters: CreateDocumentRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<Document>> {
@@ -1778,7 +1778,7 @@ export class CollaborationApi extends runtime.BaseAPI {
17781778
}
17791779

17801780
/**
1781-
* Create a document. If the document is one of {\'DWG\', \'POINT_CLOUD\', \'IFC\', \'DXF\', \'OBJ\', \'GLTF\'}, a model will be created and attached to this document Required scopes: document:write
1781+
* Create a document. If the document is one of {\'POINT_CLOUD\', \'DWG\', \'OBJ\', \'DXF\', \'IFC\', \'GLTF\'}, a model will be created and attached to this document Required scopes: document:write
17821782
* Create a document
17831783
*/
17841784
async createDocument(cloud_pk: number, project_pk: number, name: string, file: Blob, parent_id?: number | null, file_name?: string, description?: string | null, model_source?: CreateDocumentModelSourceEnum, ifc_source?: CreateDocumentIfcSourceEnum, successor_of?: number, process_hint?: CreateDocumentProcessHintEnum, initOverrides?: RequestInit): Promise<Document> {

package/src/apis/ModelApi.ts

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ import {
144144
PatchedSystemRequest,
145145
PatchedSystemRequestFromJSON,
146146
PatchedSystemRequestToJSON,
147+
PatchedTransformRequest,
148+
PatchedTransformRequestFromJSON,
149+
PatchedTransformRequestToJSON,
147150
PatchedUnitRequest,
148151
PatchedUnitRequestFromJSON,
149152
PatchedUnitRequestToJSON,
@@ -207,6 +210,9 @@ import {
207210
SystemRequest,
208211
SystemRequestFromJSON,
209212
SystemRequestToJSON,
213+
Transform,
214+
TransformFromJSON,
215+
TransformToJSON,
210216
Unit,
211217
UnitFromJSON,
212218
UnitToJSON,
@@ -1317,6 +1323,13 @@ export interface UpdateModelPropertyDefinitionRequest {
13171323
PatchedPropertyDefinitionRequest?: PatchedPropertyDefinitionRequest;
13181324
}
13191325

1326+
export interface UpdateModelTransformRequest {
1327+
cloud_pk: number;
1328+
id: number;
1329+
project_pk: number;
1330+
PatchedTransformRequest?: PatchedTransformRequest;
1331+
}
1332+
13201333
export interface UpdateModelUnitRequest {
13211334
cloud_pk: number;
13221335
id: number;
@@ -10811,6 +10824,67 @@ export class ModelApi extends runtime.BaseAPI {
1081110824
return await response.value();
1081210825
}
1081310826

10827+
/**
10828+
* Update model transform (translate, scale, rotate and opacity) Required scopes: ifc:write, model:write
10829+
* Update model transform
10830+
*/
10831+
async updateModelTransformRaw(requestParameters: UpdateModelTransformRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<Transform>> {
10832+
if (requestParameters.cloud_pk === null || requestParameters.cloud_pk === undefined) {
10833+
throw new runtime.RequiredError('cloud_pk','Required parameter requestParameters.cloud_pk was null or undefined when calling updateModelTransform.');
10834+
}
10835+
10836+
if (requestParameters.id === null || requestParameters.id === undefined) {
10837+
throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling updateModelTransform.');
10838+
}
10839+
10840+
if (requestParameters.project_pk === null || requestParameters.project_pk === undefined) {
10841+
throw new runtime.RequiredError('project_pk','Required parameter requestParameters.project_pk was null or undefined when calling updateModelTransform.');
10842+
}
10843+
10844+
const queryParameters: any = {};
10845+
10846+
const headerParameters: runtime.HTTPHeaders = {};
10847+
10848+
headerParameters['Content-Type'] = 'application/json';
10849+
10850+
if (this.configuration && this.configuration.apiKey) {
10851+
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
10852+
}
10853+
10854+
if (this.configuration && this.configuration.accessToken) {
10855+
// oauth required
10856+
headerParameters["Authorization"] = await this.configuration.accessToken("BIMData_Connect", []);
10857+
}
10858+
10859+
if (this.configuration && this.configuration.accessToken) {
10860+
// oauth required
10861+
headerParameters["Authorization"] = await this.configuration.accessToken("BIMData_Connect", []);
10862+
}
10863+
10864+
if (this.configuration && this.configuration.apiKey) {
10865+
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // Bearer authentication
10866+
}
10867+
10868+
const response = await this.request({
10869+
path: `/cloud/{cloud_pk}/project/{project_pk}/model/{id}/transform`.replace(`{${"cloud_pk"}}`, encodeURIComponent(String(requestParameters.cloud_pk))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))).replace(`{${"project_pk"}}`, encodeURIComponent(String(requestParameters.project_pk))),
10870+
method: 'PATCH',
10871+
headers: headerParameters,
10872+
query: queryParameters,
10873+
body: PatchedTransformRequestToJSON(requestParameters.PatchedTransformRequest),
10874+
}, initOverrides);
10875+
10876+
return new runtime.JSONApiResponse(response, (jsonValue) => TransformFromJSON(jsonValue));
10877+
}
10878+
10879+
/**
10880+
* Update model transform (translate, scale, rotate and opacity) Required scopes: ifc:write, model:write
10881+
* Update model transform
10882+
*/
10883+
async updateModelTransform(cloud_pk: number, id: number, project_pk: number, PatchedTransformRequest?: PatchedTransformRequest, initOverrides?: RequestInit): Promise<Transform> {
10884+
const response = await this.updateModelTransformRaw({ cloud_pk: cloud_pk, id: id, project_pk: project_pk, PatchedTransformRequest: PatchedTransformRequest }, initOverrides);
10885+
return await response.value();
10886+
}
10887+
1081410888
/**
1081510889
* Update some fields of a Unit of a model Required scopes: ifc:write, model:write
1081610890
* Update some fields of a Unit of a model

package/src/models/FullTopic.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,6 @@ export interface FullTopic {
163163
* @memberof FullTopic
164164
*/
165165
viewpoints?: Array<Viewpoint>;
166-
/**
167-
*
168-
* @type {number}
169-
* @memberof FullTopic
170-
*/
171-
project: number;
172166
/**
173167
* Non standard field. JSON describing bimdataViewerLayout.
174168
* @type {any}
@@ -208,7 +202,6 @@ export function FullTopicFromJSONTyped(json: any, ignoreDiscriminator: boolean):
208202
'due_date': !exists(json, 'due_date') ? undefined : (json['due_date'] === null ? null : new Date(json['due_date'])),
209203
'comments': !exists(json, 'comments') ? undefined : ((json['comments'] as Array<any>).map(CommentFromJSON)),
210204
'viewpoints': !exists(json, 'viewpoints') ? undefined : ((json['viewpoints'] as Array<any>).map(ViewpointFromJSON)),
211-
'project': json['project'],
212205
'bimdata_viewer_layout': !exists(json, 'bimdata_viewer_layout') ? undefined : json['bimdata_viewer_layout'],
213206
};
214207
}
@@ -242,7 +235,6 @@ export function FullTopicToJSON(value?: FullTopic | null): any {
242235
'due_date': value.due_date === undefined ? undefined : (value.due_date === null ? null : value.due_date.toISOString()),
243236
'comments': value.comments === undefined ? undefined : ((value.comments as Array<any>).map(CommentToJSON)),
244237
'viewpoints': value.viewpoints === undefined ? undefined : ((value.viewpoints as Array<any>).map(ViewpointToJSON)),
245-
'project': value.project,
246238
'bimdata_viewer_layout': value.bimdata_viewer_layout,
247239
};
248240
}

package/src/models/FullTopicRequest.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,6 @@ export interface FullTopicRequest {
157157
* @memberof FullTopicRequest
158158
*/
159159
viewpoints?: Array<ViewpointRequest>;
160-
/**
161-
*
162-
* @type {number}
163-
* @memberof FullTopicRequest
164-
*/
165-
project: number;
166160
/**
167161
* Non standard field. JSON describing bimdataViewerLayout.
168162
* @type {any}
@@ -201,7 +195,6 @@ export function FullTopicRequestFromJSONTyped(json: any, ignoreDiscriminator: bo
201195
'due_date': !exists(json, 'due_date') ? undefined : (json['due_date'] === null ? null : new Date(json['due_date'])),
202196
'comments': !exists(json, 'comments') ? undefined : ((json['comments'] as Array<any>).map(CommentRequestFromJSON)),
203197
'viewpoints': !exists(json, 'viewpoints') ? undefined : ((json['viewpoints'] as Array<any>).map(ViewpointRequestFromJSON)),
204-
'project': json['project'],
205198
'bimdata_viewer_layout': !exists(json, 'bimdata_viewer_layout') ? undefined : json['bimdata_viewer_layout'],
206199
};
207200
}
@@ -235,7 +228,6 @@ export function FullTopicRequestToJSON(value?: FullTopicRequest | null): any {
235228
'due_date': value.due_date === undefined ? undefined : (value.due_date === null ? null : value.due_date.toISOString()),
236229
'comments': value.comments === undefined ? undefined : ((value.comments as Array<any>).map(CommentRequestToJSON)),
237230
'viewpoints': value.viewpoints === undefined ? undefined : ((value.viewpoints as Array<any>).map(ViewpointRequestToJSON)),
238-
'project': value.project,
239231
'bimdata_viewer_layout': value.bimdata_viewer_layout,
240232
};
241233
}

package/src/models/LabelRequest.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ export interface LabelRequest {
2525
* @memberof LabelRequest
2626
*/
2727
label: string;
28-
/**
29-
* This field is automatically provided by the route, you don't need to provide it in the body
30-
* @type {number}
31-
* @memberof LabelRequest
32-
*/
33-
project?: number;
3428
}
3529

3630
export function LabelRequestFromJSON(json: any): LabelRequest {
@@ -44,7 +38,6 @@ export function LabelRequestFromJSONTyped(json: any, ignoreDiscriminator: boolea
4438
return {
4539

4640
'label': json['label'],
47-
'project': !exists(json, 'project') ? undefined : json['project'],
4841
};
4942
}
5043

@@ -58,7 +51,6 @@ export function LabelRequestToJSON(value?: LabelRequest | null): any {
5851
return {
5952

6053
'label': value.label,
61-
'project': value.project,
6254
};
6355
}
6456

package/src/models/Model.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ import {
3131
ModelSerializerWithoutChildrenFromJSONTyped,
3232
ModelSerializerWithoutChildrenToJSON,
3333
} from './ModelSerializerWithoutChildren';
34+
import {
35+
Transform,
36+
TransformFromJSON,
37+
TransformFromJSONTyped,
38+
TransformToJSON,
39+
} from './Transform';
3440
import {
3541
User,
3642
UserFromJSON,
@@ -257,6 +263,12 @@ export interface Model {
257263
* @memberof Model
258264
*/
259265
readonly mask_2d: Mask2D | null;
266+
/**
267+
*
268+
* @type {Transform}
269+
* @memberof Model
270+
*/
271+
readonly transform: Transform | null;
260272
/**
261273
* Contains additional pages of a pdf
262274
* @type {Array<ModelSerializerWithoutChildren>}
@@ -336,6 +348,7 @@ export function ModelFromJSONTyped(json: any, ignoreDiscriminator: boolean): Mod
336348
'page_number': json['page_number'],
337349
'layout_name': !exists(json, 'layout_name') ? undefined : json['layout_name'],
338350
'mask_2d': Mask2DFromJSON(json['mask_2d']),
351+
'transform': TransformFromJSON(json['transform']),
339352
'children': ((json['children'] as Array<any>).map(ModelSerializerWithoutChildrenFromJSON)),
340353
};
341354
}

package/src/models/ModelSerializerWithoutChildren.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ import {
2525
ModelDocumentFromJSONTyped,
2626
ModelDocumentToJSON,
2727
} from './ModelDocument';
28+
import {
29+
Transform,
30+
TransformFromJSON,
31+
TransformFromJSONTyped,
32+
TransformToJSON,
33+
} from './Transform';
2834
import {
2935
User,
3036
UserFromJSON,
@@ -251,6 +257,12 @@ export interface ModelSerializerWithoutChildren {
251257
* @memberof ModelSerializerWithoutChildren
252258
*/
253259
readonly mask_2d: Mask2D | null;
260+
/**
261+
*
262+
* @type {Transform}
263+
* @memberof ModelSerializerWithoutChildren
264+
*/
265+
readonly transform: Transform | null;
254266
}
255267

256268
/**
@@ -324,6 +336,7 @@ export function ModelSerializerWithoutChildrenFromJSONTyped(json: any, ignoreDis
324336
'page_number': json['page_number'],
325337
'layout_name': !exists(json, 'layout_name') ? undefined : json['layout_name'],
326338
'mask_2d': Mask2DFromJSON(json['mask_2d']),
339+
'transform': TransformFromJSON(json['transform']),
327340
};
328341
}
329342

package/src/models/PatchedFullTopicRequest.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,6 @@ export interface PatchedFullTopicRequest {
157157
* @memberof PatchedFullTopicRequest
158158
*/
159159
viewpoints?: Array<ViewpointRequest>;
160-
/**
161-
*
162-
* @type {number}
163-
* @memberof PatchedFullTopicRequest
164-
*/
165-
project?: number;
166160
/**
167161
* Non standard field. JSON describing bimdataViewerLayout.
168162
* @type {any}
@@ -201,7 +195,6 @@ export function PatchedFullTopicRequestFromJSONTyped(json: any, ignoreDiscrimina
201195
'due_date': !exists(json, 'due_date') ? undefined : (json['due_date'] === null ? null : new Date(json['due_date'])),
202196
'comments': !exists(json, 'comments') ? undefined : ((json['comments'] as Array<any>).map(CommentRequestFromJSON)),
203197
'viewpoints': !exists(json, 'viewpoints') ? undefined : ((json['viewpoints'] as Array<any>).map(ViewpointRequestFromJSON)),
204-
'project': !exists(json, 'project') ? undefined : json['project'],
205198
'bimdata_viewer_layout': !exists(json, 'bimdata_viewer_layout') ? undefined : json['bimdata_viewer_layout'],
206199
};
207200
}
@@ -235,7 +228,6 @@ export function PatchedFullTopicRequestToJSON(value?: PatchedFullTopicRequest |
235228
'due_date': value.due_date === undefined ? undefined : (value.due_date === null ? null : value.due_date.toISOString()),
236229
'comments': value.comments === undefined ? undefined : ((value.comments as Array<any>).map(CommentRequestToJSON)),
237230
'viewpoints': value.viewpoints === undefined ? undefined : ((value.viewpoints as Array<any>).map(ViewpointRequestToJSON)),
238-
'project': value.project,
239231
'bimdata_viewer_layout': value.bimdata_viewer_layout,
240232
};
241233
}

package/src/models/PatchedLabelRequest.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ export interface PatchedLabelRequest {
2525
* @memberof PatchedLabelRequest
2626
*/
2727
label?: string;
28-
/**
29-
* This field is automatically provided by the route, you don't need to provide it in the body
30-
* @type {number}
31-
* @memberof PatchedLabelRequest
32-
*/
33-
project?: number;
3428
}
3529

3630
export function PatchedLabelRequestFromJSON(json: any): PatchedLabelRequest {
@@ -44,7 +38,6 @@ export function PatchedLabelRequestFromJSONTyped(json: any, ignoreDiscriminator:
4438
return {
4539

4640
'label': !exists(json, 'label') ? undefined : json['label'],
47-
'project': !exists(json, 'project') ? undefined : json['project'],
4841
};
4942
}
5043

@@ -58,7 +51,6 @@ export function PatchedLabelRequestToJSON(value?: PatchedLabelRequest | null): a
5851
return {
5952

6053
'label': value.label,
61-
'project': value.project,
6254
};
6355
}
6456

0 commit comments

Comments
 (0)