feat: 支持关卡配置分享

This commit is contained in:
richarjiang
2026-04-06 17:32:20 +08:00
parent 9ab78555cb
commit 3a1b4d22bf
15 changed files with 418 additions and 3 deletions

View File

@@ -0,0 +1,30 @@
import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { ShareParticipant } from '../entities/share-participant.entity';
@Injectable()
export class ShareParticipantRepository {
constructor(
@InjectRepository(ShareParticipant)
private readonly repository: Repository<ShareParticipant>,
) {}
/** 添加参与者(已存在则忽略) */
async addParticipant(
shareConfigId: string,
participantId: string,
): Promise<void> {
await this.repository
.createQueryBuilder()
.insert()
.into(ShareParticipant)
.values({ shareConfigId, participantId })
.orIgnore()
.execute();
}
async countByShareConfigId(shareConfigId: string): Promise<number> {
return this.repository.count({ where: { shareConfigId } });
}
}