Appease the linter

This commit is contained in:
Travis Ralston 2018-03-24 15:05:26 -06:00
parent bc4319da7d
commit cc921779ae
2 changed files with 22 additions and 22 deletions

View File

@ -87,45 +87,45 @@ export class NebStore {
}
public static async getConfig(id: number): Promise<NebConfig> {
const config = await NebConfiguration.findByPrimary(id);
if (!config) throw new Error("Configuration not found");
const nebConfig = await NebConfiguration.findByPrimary(id);
if (!nebConfig) throw new Error("Configuration not found");
const integrations = await NebIntegration.findAll({where: {nebId: id}});
const fullIntegrations = await NebStore.getCompleteIntegrations(config, integrations);
const fullIntegrations = await NebStore.getCompleteIntegrations(nebConfig, integrations);
return new NebConfig(config, fullIntegrations);
return new NebConfig(nebConfig, fullIntegrations);
}
public static async createForUpstream(upstreamId: number): Promise<NebConfig> {
const upstream = await Upstream.findByPrimary(upstreamId);
if (!upstream) throw new Error("Upstream not found");
const config = await NebConfiguration.create({
const nebConfig = await NebConfiguration.create({
upstreamId: upstream.id,
});
return NebStore.getConfig(config.id);
return NebStore.getConfig(nebConfig.id);
}
public static async createForAppservice(appserviceId: string, adminUrl: string): Promise<NebConfig> {
const appservice = await AppService.findByPrimary(appserviceId);
if (!appservice) throw new Error("Appservice not found");
const config = await NebConfiguration.create({
const nebConfig = await NebConfiguration.create({
appserviceId: appservice.id,
adminUrl: adminUrl,
});
return NebStore.getConfig(config.id);
return NebStore.getConfig(nebConfig.id);
}
public static async getOrCreateIntegration(configurationId: number, integrationType: string): Promise<NebIntegration> {
if (!NebStore.INTEGRATIONS[integrationType]) throw new Error("Integration not supported");
const config = await NebConfiguration.findByPrimary(configurationId);
if (!config) throw new Error("Configuration not found");
const nebConfig = await NebConfiguration.findByPrimary(configurationId);
if (!nebConfig) throw new Error("Configuration not found");
let integration = await NebIntegration.findOne({where: {nebId: config.id, type: integrationType}});
let integration = await NebIntegration.findOne({where: {nebId: nebConfig.id, type: integrationType}});
if (!integration) {
LogService.info("NebStore", "Creating integration " + integrationType + " for NEB " + configurationId);
integration = await NebIntegration.create({
@ -171,9 +171,9 @@ export class NebStore {
for (const type of Object.keys(NebStore.INTEGRATIONS)) {
if (nebConfig.upstreamId && NebStore.INTEGRATIONS_MODULAR_SUPPORTED.indexOf(type) === -1) continue;
const config = JSON.parse(JSON.stringify(NebStore.INTEGRATIONS[type]));
config["type"] = type;
result.push(config);
const integrationConfig = JSON.parse(JSON.stringify(NebStore.INTEGRATIONS[type]));
integrationConfig["type"] = type;
result.push(integrationConfig);
}
return result;

View File

@ -17,7 +17,7 @@ export class NebClient {
}
public async updateUser(userId: string, isEnabled: boolean, sync = true, autoAcceptInvites = true): Promise<any> {
const request: Client = {
const nebRequest: Client = {
UserID: userId,
HomeserverURL: await getFederationUrl(config.homeserver.name),
AccessToken: (isEnabled ? await this.getAccessToken(userId) : "DISABLED"),
@ -25,25 +25,25 @@ export class NebClient {
AutoJoinRooms: autoAcceptInvites
};
return this.doRequest("/admin/configureClient", request);
return this.doRequest("/admin/configureClient", nebRequest);
}
public async setServiceConfig(serviceId: string, userId: string, type: string, config: any): Promise<any> {
const request: Service = {
public async setServiceConfig(serviceId: string, userId: string, type: string, serviceConfig: any): Promise<any> {
const nebRequest: Service = {
ID: serviceId,
Type: type,
UserID: userId,
Config: config,
Config: serviceConfig,
};
return this.doRequest("/admin/configureService", request);
return this.doRequest("/admin/configureService", nebRequest);
}
public async getServiceConfig(serviceId: string): Promise<any> {
const request = {ID: serviceId};
const nebRequest = {ID: serviceId};
try {
const service = await this.doRequest<Service>("/admin/getService", request);
const service = await this.doRequest<Service>("/admin/getService", nebRequest);
return service.Config;
} catch (err) {
LogService.error("NebClient", err);