Explorar o código

Fix code smells

Nicolas Meienberger %!s(int64=3) %!d(string=hai) anos
pai
achega
c8680f0bd2

+ 1 - 1
packages/dashboard/src/modules/AppStore/helpers/table.helpers.ts

@@ -15,7 +15,7 @@ export const sortTable = (data: AppTableData, col: keyof Pick<AppInfo, 'name'>,
   });
 
   if (categories.length > 0) {
-    return sortedData.filter((app) => app.categories.some((c) => categories.includes(c as AppCategoriesEnum))).filter((app) => app.name.toLowerCase().includes(search.toLowerCase()));
+    return sortedData.filter((app) => app.categories.some((c) => categories.includes(c))).filter((app) => app.name.toLowerCase().includes(search.toLowerCase()));
   } else {
     return sortedData.filter((app) => app.name.toLowerCase().includes(search.toLowerCase()));
   }

+ 3 - 1
packages/system-api/src/modules/apps/apps.service.ts

@@ -3,6 +3,8 @@ import { checkAppRequirements, checkEnvFile, generateEnvFile, getAvailableApps,
 import { AppInfo, AppStatusEnum, ListAppsResonse } from './apps.types';
 import App from './app.entity';
 
+const sortApps = (a: AppInfo, b: AppInfo) => a.name.localeCompare(b.name);
+
 const startAllApps = async (): Promise<void> => {
   const apps = await App.find({ where: { status: AppStatusEnum.RUNNING } });
 
@@ -86,7 +88,7 @@ const listApps = async (): Promise<ListAppsResonse> => {
     app.description = readFile(`/apps/${app.id}/metadata/description.md`);
   });
 
-  return { apps: apps.sort((a, b) => a.name.localeCompare(b.name)), total: apps.length };
+  return { apps: apps.sort(sortApps), total: apps.length };
 };
 
 const updateAppConfig = async (id: string, form: Record<string, string>): Promise<App> => {

+ 1 - 3
packages/system-api/src/modules/auth/auth.resolver.ts

@@ -9,9 +9,7 @@ import User from './user.entity';
 export default class AuthResolver {
   @Query(() => User, { nullable: true })
   async me(@Ctx() ctx: MyContext): Promise<User | null> {
-    const user = await AuthService.me(ctx.req.session.userId);
-
-    return user;
+    return AuthService.me(ctx.req.session.userId);
   }
 
   @Mutation(() => UserResponse)