import {Model, ModelOptions} from "pinia-orm"; import {randomUUID} from "crypto"; /** * Base class for resources that can be fetched from the API */ export class ApiResource extends Model { /** * Is it a newly created entity? * * If it is, it means this entity does not exist in the data source and that it has a temporary id */ public isNew(): boolean { return !this.id || (typeof this.id === 'string' && this.id.slice(0, 3) === 'tmp') } } export default ApiResource