chore: rename isAPIEnabled to apiEnabled

This commit is contained in:
Saleel
2023-04-15 00:01:41 +05:30
parent 52b09ea780
commit dbc8a7593f
3 changed files with 9 additions and 7 deletions

View File

@@ -32,7 +32,7 @@ export class Group {
members: Member[]
@Column({ default: false })
isAPIEnabled: boolean
apiEnabled: boolean
@Column({ nullable: true })
apiKey: string

View File

@@ -167,7 +167,7 @@ export class GroupsService {
): Promise<Group> {
const group = await this.getGroup(groupId)
if (!group.isAPIEnabled) {
if (!group.apiEnabled) {
throw new BadRequestException(
`API is not enabled for the group '${groupId}'`
)
@@ -337,7 +337,7 @@ export class GroupsService {
}
return {
isEnabled: group.isAPIEnabled,
isEnabled: group.apiEnabled,
apiKey: group.apiKey
}
}
@@ -359,11 +359,11 @@ export class GroupsService {
}
if (isEnabled === true) {
if (!group.isAPIEnabled) {
if (!group.apiEnabled) {
Logger.log(
`GroupsService: Enabling API Access for group ${group.id}`
)
group.isAPIEnabled = true
group.apiEnabled = true
}
// Generate a new API key if it doesn't exist
@@ -373,13 +373,13 @@ export class GroupsService {
}
if (isEnabled === false) {
group.isAPIEnabled = false
group.apiEnabled = false
}
this.groupRepository.save(group)
return {
isEnabled: group.isAPIEnabled,
isEnabled: group.apiEnabled,
apiKey: group.apiKey
}
}

View File

@@ -32,6 +32,8 @@ CREATE TABLE groups (
"treeDepth" integer NOT NULL,
"createdAt" timestamp without time zone NOT NULL DEFAULT now(),
tag integer NOT NULL DEFAULT 0
apiEnabled boolean NOT NULL DEFAULT false,
apiKey character varying
);
-- Indices -------------------------------------------------------