feat(nestjs): migrate to NestJS

This commit is contained in:
Ahmed Bouhuolia
2025-04-07 11:51:24 +02:00
parent f068218a16
commit 55fcc908ef
3779 changed files with 631 additions and 195332 deletions

View File

@@ -0,0 +1,26 @@
import { mixin } from 'objection';
// import TenantModel from 'models/TenantModel';
// import ModelSetting from './ModelSetting';
// import ModelSearchable from './ModelSearchable';
import { BaseModel } from '@/models/Model';
export class Document extends BaseModel {
public key: string;
public mimeType: string;
public size?: number;
public originName?: string;
/**
* Table name
*/
static get tableName() {
return 'documents';
}
/**
* Model timestamps.
*/
get timestamps() {
return ['createdAt', 'updatedAt'];
}
}

View File

@@ -0,0 +1,47 @@
import { Model, mixin } from 'objection';
// import TenantModel from 'models/TenantModel';
// import ModelSetting from './ModelSetting';
// import ModelSearchable from './ModelSearchable';
import { BaseModel } from '@/models/Model';
export class DocumentLink extends BaseModel{
public modelRef: string;
public modelId: number;
public documentId: number;
public expiresAt?: Date;
/**
* Table name
*/
static get tableName() {
return 'document_links';
}
/**
* Model timestamps.
*/
get timestamps() {
return ['createdAt', 'updatedAt'];
}
/**
* Relationship mapping.
*/
static get relationMappings() {
const Document = require('./Document');
return {
/**
* Sale invoice associated entries.
*/
document: {
relation: Model.HasOneRelation,
modelClass: Document.default,
join: {
from: 'document_links.documentId',
to: 'documents.id',
},
},
};
}
}