import Item from "./item"; export default class Stock { constructor( public item: Item, public code: string, public assignedToId?: number, public encodedCode?: string, public id?: string, ) { } static encode() { let result = ""; const characters = "abcdefghijklmnopqrstuvwxyz0123456789"; const charactersLength = characters.length; let counter = 0; while (counter < 8) { result += characters.charAt(Math.floor(Math.random() * charactersLength)); counter += 1; } return result; } }