@shirokuma-library/mcp-knowledge-base
Version:
MCP server for AI-powered knowledge management with semantic search, graph analysis, and automatic enrichment
42 lines (41 loc) • 1.39 kB
JavaScript
import { Status } from '../entities/Status.js';
import { AppDataSource } from '../data-source.js';
export class StatusRepository {
repository;
constructor() {
this.repository = AppDataSource.getRepository(Status);
}
async findByName(name) {
return await this.repository
.createQueryBuilder('status')
.where('LOWER(status.name) = LOWER(:name)', { name })
.getOne();
}
async findByClosable(isClosable) {
return await this.repository.find({
where: { isClosable }
});
}
async findAll() {
return await this.repository.find({
order: { sortOrder: 'ASC' }
});
}
async fixClosableFlags() {
const closableNames = ['Completed', 'Closed', 'Canceled', 'Rejected'];
const openNames = ['Open', 'Ready', 'In Progress', 'Review',
'Specification', 'Waiting', 'Testing', 'Pending'];
await this.repository
.createQueryBuilder()
.update(Status)
.set({ isClosable: true })
.where('name IN (:...names)', { names: closableNames })
.execute();
await this.repository
.createQueryBuilder()
.update(Status)
.set({ isClosable: false })
.where('name IN (:...names)', { names: openNames })
.execute();
}
}