mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-02 05:54:44 +00:00
feat(skill): add team owner skill permission control
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { prisma } from '@shumai/db'
|
||||
import { prisma, type TeamMemberRole } from '@shumai/db'
|
||||
import { SkillInfo, UpsertSkillRequest } from '@shumai/dtos'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
import AdmZip from 'adm-zip'
|
||||
@@ -125,6 +125,14 @@ export class SkillService {
|
||||
return this.toSkillInfo(skill)
|
||||
}
|
||||
|
||||
async updateSkillPermission(id: string, permission: TeamMemberRole): Promise<SkillInfo> {
|
||||
const skill = await this.prismaClient.skill.update({
|
||||
where: { id },
|
||||
data: { permission },
|
||||
})
|
||||
return this.toSkillInfo(skill)
|
||||
}
|
||||
|
||||
async listSkills(teamId: string): Promise<SkillInfo[]> {
|
||||
const skills = await this.prismaClient.skill.findMany({
|
||||
where: { teamId },
|
||||
@@ -276,6 +284,7 @@ export class SkillService {
|
||||
config: s.config as PrismaJson.SkillConfig,
|
||||
assetId: s.assetId,
|
||||
hash: s.hash,
|
||||
permission: s.permission || 'reviewer',
|
||||
createdAt: s.createdAt.toISOString(),
|
||||
updatedAt: s.updatedAt.toISOString(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user