2025-02-21 18:30:13 +08:00
|
|
|
import BaseDao from "./BaseDao";
|
|
|
|
|
|
|
|
class VersionDao extends BaseDao<FrpcVersion> {
|
|
|
|
constructor() {
|
|
|
|
super("version");
|
|
|
|
}
|
|
|
|
|
|
|
|
findByGithubReleaseId(githubReleaseId: number): Promise<FrpcVersion> {
|
|
|
|
return new Promise<FrpcVersion>((resolve, reject) => {
|
|
|
|
this.db.findOne({ githubReleaseId: githubReleaseId }, (err, document) => {
|
|
|
|
if (err) {
|
|
|
|
reject(err);
|
|
|
|
} else {
|
|
|
|
resolve(document);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
exists(githubReleaseId: number): Promise<boolean> {
|
2025-02-23 02:11:17 +08:00
|
|
|
return new Promise(( resolve, reject) => {
|
2025-02-21 18:30:13 +08:00
|
|
|
this.db.count({ githubReleaseId: githubReleaseId }, (err, count) => {
|
|
|
|
if (err) {
|
|
|
|
reject(err);
|
|
|
|
} else {
|
|
|
|
resolve(count > 0);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default VersionDao;
|