This document provides a concise guide to the SwitchType module, focusing on the SwitchType model and its usage.
Defines the structure for SwitchType entities.
type SwitchType = {
_id?: string;
id: string;
createdAt: Date | string;
updatedAt: Date | string;
deletedAt?: Date;
code: string;
brand?: string | null;
mold?: string | null;
description?: string | null;
ratio: number;
isDrop: boolean;
manageable: boolean;
size: number;
};
Defines the structure for creating a new SwitchType.
type CreateSwitchTypeDTO = {
code?: string;
brand?: string | null;
mold?: string | null;
description?: string | null;
ratio?: number;
isDrop?: boolean;
manageable?: boolean;
size?: number;
external_id?: any;
};
Defines the structure for updating an existing SwitchType.
type UpdateSwitchTypeDTO = {
code?: string;
brand?: string | null;
mold?: string | null;
description?: string | null;
ratio?: number;
isDrop?: boolean;
manageable?: boolean;
size?: number;
external_id?: any;
};
import OZMapSDK from 'ozmapsdk';
const sdk = new OZMapSDK('ozmapURL', { apiKey: 'yourApiKey' });
const newSwitchTypeData: CreateSwitchTypeDTO = {
code: 'SW001',
brand: 'BrandX',
mold: 'MoldY',
description: 'Description here',
ratio: 5,
isDrop: true,
manageable: false,
size: 10,
};
sdk.switchType.create(newSwitchTypeData).then((switchType) => {
console.log('SwitchType created:', switchType);
});
import OZMapSDK from 'ozmapsdk';
const sdk = new OZMapSDK('ozmapURL', { apiKey: 'yourApiKey' });
const updateSwitchTypeData: UpdateSwitchTypeDTO = {
description: 'Updated description',
};
sdk.switchType.updateById('switchTypeId', updateSwitchTypeData).then(() => {
console.log('SwitchType updated');
});
import OZMapSDK from 'ozmapsdk';
const sdk = new OZMapSDK('ozmapURL', { apiKey: 'yourApiKey' });
sdk.switchType.deleteById('switchTypeId').then(() => {
console.log('SwitchType deleted');
});
import OZMapSDK from 'ozmapsdk';
const sdk = new OZMapSDK('ozmapURL', { apiKey: 'yourApiKey' });
sdk.switchType.find({ page: 1, limit: 10 }).then((pagination) => {
console.log('SwitchType:', pagination);
});
import OZMapSDK from 'ozmapsdk';
const sdk = new OZMapSDK('ozmapURL', { apiKey: 'yourApiKey' });
sdk.switchType.findById('SwitchTypeId').then((SwitchType) => {
console.log('SwitchType:', SwitchType);
});