Skip to content

Commit

Permalink
fix: remove custom prettier configs
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonejt committed Jul 15, 2024
1 parent 3685154 commit be7c80f
Show file tree
Hide file tree
Showing 27 changed files with 1,299 additions and 1,315 deletions.
3 changes: 0 additions & 3 deletions .prettierrc.yml

This file was deleted.

166 changes: 83 additions & 83 deletions clients/backend/communities.ts
Original file line number Diff line number Diff line change
@@ -1,96 +1,96 @@
interface Community {
id: number;
platform: number;
community_id: string;
communityID?: string;
discord_log_channel?: string;
discord_notify_target?: string;
id: number;
platform: number;
community_id: string;
communityID?: string;
discord_log_channel?: string;
discord_notify_target?: string;
}

export default class Communities {
static url = `${process.env.BACKEND_URL!}/community`;
static url = `${process.env.BACKEND_URL!}/community`;

static async create(communityID: string): Promise<Community | undefined> {
try {
const response = await fetch(this.url, {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json",
"User-Agent": `${process.env.npm_package_name}/${process.env.npm_package_version!} node.js/${process.version}`,
Authorization: `Token ${process.env.BACKEND_API_KEY!}`,
},
body: JSON.stringify({ communityID }),
});
if (!response.ok)
throw new Error(
`POST ${this.url}: ${response.status} ${response.statusText}`
);
return await response.json();
} catch (error) {
console.error(error);
}
static async create(communityID: string): Promise<Community | undefined> {
try {
const response = await fetch(this.url, {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json",
"User-Agent": `${process.env.npm_package_name}/${process.env.npm_package_version!} node.js/${process.version}`,
Authorization: `Token ${process.env.BACKEND_API_KEY!}`,
},
body: JSON.stringify({ communityID }),
});
if (!response.ok)
throw new Error(
`POST ${this.url}: ${response.status} ${response.statusText}`,
);
return await response.json();
} catch (error) {
console.error(error);
}
}

static async read(communityID: string): Promise<Community | undefined> {
try {
const response = await fetch(`${this.url}?id=${communityID}`, {
method: "GET",
headers: {
Accept: "application/json",
"User-Agent": `${process.env.npm_package_name}/${process.env.npm_package_version!} node.js/${process.version}`,
Authorization: `Token ${process.env.BACKEND_API_KEY!}`,
},
});
if (!response.ok)
throw new Error(
`GET ${this.url}?id=${communityID}: ${response.status} ${response.statusText}`
);
return await response.json();
} catch (error) {
console.error(error);
}
static async read(communityID: string): Promise<Community | undefined> {
try {
const response = await fetch(`${this.url}?id=${communityID}`, {
method: "GET",
headers: {
Accept: "application/json",
"User-Agent": `${process.env.npm_package_name}/${process.env.npm_package_version!} node.js/${process.version}`,
Authorization: `Token ${process.env.BACKEND_API_KEY!}`,
},
});
if (!response.ok)
throw new Error(
`GET ${this.url}?id=${communityID}: ${response.status} ${response.statusText}`,
);
return await response.json();
} catch (error) {
console.error(error);
}
}

static async update(
data: Partial<Community>
): Promise<Community | undefined> {
try {
const response = await fetch(this.url, {
method: "PUT",
headers: {
Accept: "application/json",
"Content-Type": "application/json",
"User-Agent": `${process.env.npm_package_name}/${process.env.npm_package_version!} node.js/${process.version}`,
Authorization: `Token ${process.env.BACKEND_API_KEY!}`,
},
body: JSON.stringify(data),
});
if (!response.ok)
throw new Error(
`PUT ${this.url}: ${response.status} ${response.statusText}`
);
return await response.json();
} catch (error) {
console.error(error);
}
static async update(
data: Partial<Community>,
): Promise<Community | undefined> {
try {
const response = await fetch(this.url, {
method: "PUT",
headers: {
Accept: "application/json",
"Content-Type": "application/json",
"User-Agent": `${process.env.npm_package_name}/${process.env.npm_package_version!} node.js/${process.version}`,
Authorization: `Token ${process.env.BACKEND_API_KEY!}`,
},
body: JSON.stringify(data),
});
if (!response.ok)
throw new Error(
`PUT ${this.url}: ${response.status} ${response.statusText}`,
);
return await response.json();
} catch (error) {
console.error(error);
}
}

static async delete(communityID: string) {
try {
const response = await fetch(`${this.url}?id=${communityID}`, {
method: "DELETE",
headers: {
"User-Agent": `${process.env.npm_package_name}/${process.env.npm_package_version!} node.js/${process.version}`,
Authorization: `Token ${process.env.BACKEND_API_KEY!}`,
},
});
if (!response.ok)
throw new Error(
`DELETE ${this.url}?id=${communityID}: ${response.status} ${response.statusText}`
);
} catch (error) {
console.error(error);
}
static async delete(communityID: string) {
try {
const response = await fetch(`${this.url}?id=${communityID}`, {
method: "DELETE",
headers: {
"User-Agent": `${process.env.npm_package_name}/${process.env.npm_package_version!} node.js/${process.version}`,
Authorization: `Token ${process.env.BACKEND_API_KEY!}`,
},
});
if (!response.ok)
throw new Error(
`DELETE ${this.url}?id=${communityID}: ${response.status} ${response.statusText}`,
);
} catch (error) {
console.error(error);
}
}
}
154 changes: 76 additions & 78 deletions clients/backend/dominator/memberDominators.ts
Original file line number Diff line number Diff line change
@@ -1,90 +1,88 @@
export interface MemberDominator {
id: number;
community: number;
communityID?: string;
id: number;
community: number;
communityID?: string;

crime_coefficient_100_action: number;
crime_coefficient_300_action: number;
toxicity_action: number;
toxicity_threshold: number;
severe_toxicity_action: number;
severe_toxicity_threshold: number;
identity_attack_action: number;
identity_attack_threshold: number;
insult_action: number;
insult_threshold: number;
threat_action: number;
threat_threshold: number;
profanity_action: number;
profanity_threshold: number;
sexually_explicit_action: number;
sexually_explicit_threshold: number;
crime_coefficient_100_action: number;
crime_coefficient_300_action: number;
toxicity_action: number;
toxicity_threshold: number;
severe_toxicity_action: number;
severe_toxicity_threshold: number;
identity_attack_action: number;
identity_attack_threshold: number;
insult_action: number;
insult_threshold: number;
threat_action: number;
threat_threshold: number;
profanity_action: number;
profanity_threshold: number;
sexually_explicit_action: number;
sexually_explicit_threshold: number;
}

export class MemberDominators {
static url = `${process.env.BACKEND_URL!}/dominator/member`;
static url = `${process.env.BACKEND_URL!}/dominator/member`;

static async read(
communityID: string
): Promise<MemberDominator | undefined> {
try {
const response = await fetch(`${this.url}?id=${communityID}`, {
method: "GET",
headers: {
Accept: "application/json",
"User-Agent": `${process.env.npm_package_name}/${process.env.npm_package_version!} node.js/${process.version}`,
Authorization: `Token ${process.env.BACKEND_API_KEY!}`,
},
});
if (!response.ok)
throw new Error(
`GET ${this.url}?id=${communityID}: ${response.status} ${response.statusText}`
);
return await response.json();
} catch (error) {
console.error(error);
}
static async read(communityID: string): Promise<MemberDominator | undefined> {
try {
const response = await fetch(`${this.url}?id=${communityID}`, {
method: "GET",
headers: {
Accept: "application/json",
"User-Agent": `${process.env.npm_package_name}/${process.env.npm_package_version!} node.js/${process.version}`,
Authorization: `Token ${process.env.BACKEND_API_KEY!}`,
},
});
if (!response.ok)
throw new Error(
`GET ${this.url}?id=${communityID}: ${response.status} ${response.statusText}`,
);
return await response.json();
} catch (error) {
console.error(error);
}
}

static async update(
data: Partial<MemberDominator>
): Promise<MemberDominator | undefined> {
try {
const response = await fetch(this.url, {
method: "PUT",
headers: {
Accept: "application/json",
"Content-Type": "application/json",
"User-Agent": `${process.env.npm_package_name}/${process.env.npm_package_version!} node.js/${process.version}`,
Authorization: `Token ${process.env.BACKEND_API_KEY!}`,
},
body: JSON.stringify(data),
});
if (!response.ok)
throw new Error(
`PUT ${this.url}: ${response.status} ${response.statusText}`
);
return await response.json();
} catch (error) {
console.error(error);
}
static async update(
data: Partial<MemberDominator>,
): Promise<MemberDominator | undefined> {
try {
const response = await fetch(this.url, {
method: "PUT",
headers: {
Accept: "application/json",
"Content-Type": "application/json",
"User-Agent": `${process.env.npm_package_name}/${process.env.npm_package_version!} node.js/${process.version}`,
Authorization: `Token ${process.env.BACKEND_API_KEY!}`,
},
body: JSON.stringify(data),
});
if (!response.ok)
throw new Error(
`PUT ${this.url}: ${response.status} ${response.statusText}`,
);
return await response.json();
} catch (error) {
console.error(error);
}
}

static async delete(communityID: string) {
try {
const response = await fetch(`${this.url}?id=${communityID}`, {
method: "DELETE",
headers: {
"User-Agent": `${process.env.npm_package_name}/${process.env.npm_package_version!} node.js/${process.version}`,
Authorization: `Token ${process.env.BACKEND_API_KEY!}`,
},
});
if (!response.ok)
throw new Error(
`DELETE ${this.url}?id=${communityID}: ${response.status} ${response.statusText}`
);
} catch (error) {
console.error(error);
}
static async delete(communityID: string) {
try {
const response = await fetch(`${this.url}?id=${communityID}`, {
method: "DELETE",
headers: {
"User-Agent": `${process.env.npm_package_name}/${process.env.npm_package_version!} node.js/${process.version}`,
Authorization: `Token ${process.env.BACKEND_API_KEY!}`,
},
});
if (!response.ok)
throw new Error(
`DELETE ${this.url}?id=${communityID}: ${response.status} ${response.statusText}`,
);
} catch (error) {
console.error(error);
}
}
}
Loading

0 comments on commit be7c80f

Please sign in to comment.