This document provides a concise guide to the DuctType module, focusing on the DuctType model and its Data Transfer Objects (DTOs) for creation and update operations.
Defines the structure for duct types.
type DuctType = {
id: string;
code: string;
brand?: string;
mold?: string;
description?: string;
subDucts?: SubDuctStructure[];
config: {
regular: {
color: string;
weight: number;
};
notImplanted: {
color: string;
weight: number;
};
};
external_id?: any;
};
Defines the structure for sub-ducts within a duct type.
type SubDuctStructure = {
ductType?: string | null;
color?: string | null;
subDucts?: SubDuctStructure[] | null;
};
Defines the structure for creating a duct type.
type CreateDuctTypeDTO = {
code: string;
brand?: string;
mold?: string;
description?: string;
subDucts?: SubDuctStructure[];
config?: {
regular?: {
color?: string;
weight?: number;
};
notImplanted?: {
color?: string;
weight?: number;
};
};
external_id?: any;
};
Defines the structure for updating a duct type.
type UpdateDuctTypeDTO = {
code?: string;
brand?: string;
mold?: string;
description?: string;
subDucts?: SubDuctStructure[];
config?: {
regular?: {
color?: string;
weight?: number;
};
notImplanted?: {
color?: string;
weight?: number;
};
};
external_id?: any;
};
import OZMapSDK from 'ozmapsdk';
import { CreateDuctTypeDTO } from './DuctType';
const sdk = new OZMapSDK('ozmapURL', { apiKey: 'yourApiKey' });
const newDuctTypeData: CreateDuctTypeDTO = {
code: "DUCT_TYPE_001",
brand: "BrandName",
description: "Description of the duct type",
subDucts: [{ ductType: "subDuctTypeId", color: "colorId" }],
config: {
regular: { color: "#FFFFFF", weight: 10 },
notImplanted: { color: "#CCCCCC", weight: 5 },
},
};
sdk.ductType.create(newDuctTypeData).then((ductType) => {
console.log('DuctType created:', ductType);
});
import OZMapSDK from 'ozmapsdk';
import { UpdateDuctTypeDTO } from './DuctType';
const sdk = new OZMapSDK('ozmapURL', { apiKey: 'yourApiKey' });
const updateDuctTypeData: UpdateDuctTypeDTO = {
brand: "UpdatedBrandName",
description: "Updated description",
};
sdk.ductType.updateById('ductTypeId', updateDuctTypeData).then(() => {
console.log('DuctType updated');
});
import OZMapSDK from 'ozmapsdk';
const sdk = new OZMapSDK('ozmapURL', { apiKey: 'yourApiKey' });
sdk.ductType.find({ page: 1, limit: 10 }).then((pagination) => {
console.log('DuctTypes:', pagination);
});
import OZMapSDK from 'ozmapsdk';
const sdk = new OZMapSDK('ozmapURL', { apiKey: 'yourApiKey' });
sdk.ductType.findById('ductTypeId').then((ductType) => {
console.log('DuctType:', ductType);
});
import OZMapSDK from 'ozmapsdk';
const sdk = new OZMapSDK('ozmapURL', { apiKey: 'yourApiKey' });
sdk.ductType.deleteById('ductTypeId').then(() => {
console.log('DuctType deleted');
});