Skip to content
Snippets Groups Projects
Commit d865af98 authored by Guilherme Gazzo's avatar Guilherme Gazzo
Browse files

stopt using `_updatedAtIndexOptions` and use `modelIdexes` instead

parent 617aacbe
No related tags found
No related merge requests found
......@@ -4,8 +4,22 @@ import type { Db, DeleteResult, Filter } from 'mongodb';
import { BaseRaw } from './BaseRaw';
export class AppsLogsModel extends BaseRaw<any> implements IAppLogsModel {
constructor(db: Db) {
super(db, 'apps_logs', undefined, { _updatedAtIndexOptions: { expireAfterSeconds: 60 * 60 * 24 * 30 } });
constructor(
db: Db,
private readonly expireAfterSeconds: number = 60 * 60 * 24 * 30,
) {
super(db, 'apps_logs', undefined);
}
protected modelIndexes() {
return [
{
key: {
_updatedAt: 1,
},
expireAfterSeconds: this.expireAfterSeconds,
},
];
}
remove(query: Filter<any>): Promise<DeleteResult> {
......
......@@ -72,7 +72,7 @@ export abstract class BaseRaw<
private db: Db,
protected name: string,
protected trash?: Collection<TDeleted>,
private options?: ModelOptions,
options?: ModelOptions,
) {
this.collectionName = options?.collectionNameResolver ? options.collectionNameResolver(name) : getCollectionName(name);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment