remove mark

This commit is contained in:
2025-12-04 10:31:37 +08:00
parent 46aa293cce
commit 2a55f2d3ef
35 changed files with 1837 additions and 726 deletions

View File

@@ -1,58 +0,0 @@
import { FindAttributeOptions, Op } from 'sequelize';
import { MarkModel } from '../model.ts';
export class MarkServices {
static getList = async (opts: {
/** 查询用户的 */
uid?: string;
query?: {
page?: number;
pageSize?: number;
search?: string;
markType?: string;
sort?: string;
};
/**
* 查询类型
* simple: 简单查询 默认
*/
queryType?: string;
}) => {
const { uid, query } = opts;
const { page = 1, pageSize = 999, search, sort = 'DESC' } = query;
const searchWhere = search
? {
[Op.or]: [{ title: { [Op.like]: `%${search}%` } }, { summary: { [Op.like]: `%${search}%` } }],
}
: {};
if (opts.query?.markType) {
searchWhere['markType'] = opts.query.markType;
}
const attributes: FindAttributeOptions = {
exclude: [],
};
const queryType = opts.queryType || 'simple';
if (queryType === 'simple') {
// attributes.include = ['id', 'title', 'link', 'summary', 'thumbnail', 'markType', 'tags', 'uid', 'share', 'uname'];
attributes.exclude = ['data', 'config', 'cover', 'description'];
}
const { rows, count } = await MarkModel.findAndCountAll({
where: {
uid: uid,
...searchWhere,
},
order: [['updatedAt', sort]],
attributes: attributes,
limit: pageSize,
offset: (page - 1) * pageSize,
});
return {
pagination: {
current: page,
pageSize,
total: count,
},
list: rows,
};
};
}