Skip to content

Commit

Permalink
chore: apply linter
Browse files Browse the repository at this point in the history
  • Loading branch information
albanm committed Oct 28, 2024
1 parent 7d06a89 commit 7de355e
Show file tree
Hide file tree
Showing 39 changed files with 606 additions and 617 deletions.
15 changes: 2 additions & 13 deletions api/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import apiDocs from '../contract/api-docs.ts'
import express, { type RequestHandler } from 'express'
import bodyParser from 'body-parser'
import cookieParser from 'cookie-parser'
import { session, errorHandler, createSiteMiddleware, createSpaMiddleware, setReqUser, reqSession, httpError } from '@data-fair/lib-express'
import { session, errorHandler, createSiteMiddleware, createSpaMiddleware, setReqUser, httpError } from '@data-fair/lib-express'
import admin from './admin/router.ts'
import anonymousAction from './anonymous-action/router.ts'
import auth from './auth/router.ts'
Expand Down Expand Up @@ -34,17 +34,6 @@ app.use(session.middleware())

// minimalist api key management
const readApiKey: RequestHandler = async (req, res, next) => {
/*
// always refresh session user with actual current data
const sessionState = reqSession(req)
if (sessionState.user && !sessionState.user.os && sessionState.user.id !== '_superadmin') {
const fullUser = await storages.globalStorage.getUser(sessionState.user.id)
if (fullUser) {
sessionState.user = getTokenPayload(fullUser)
}
}
*/

const apiKey = req.get('x-apiKey') || req.get('x-api-key') || req.query.apiKey
if (apiKey) {
if (apiKey !== config.secretKeys.readAll) {
Expand Down Expand Up @@ -89,6 +78,6 @@ app.use('/api/', (req, res) => {
})
app.use(tokens)

// app.use(await createSpaMiddleware(resolve(import.meta.dirname, '../../ui/dist'), uiConfig))
app.use(await createSpaMiddleware(resolve(import.meta.dirname, '../../ui/dist'), uiConfig))

app.use(errorHandler)
1 change: 0 additions & 1 deletion api/src/limits/service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { Organization, Limits } from '#types'
import config from '#config'
import mongo from '#mongo'
import { type Account } from '@data-fair/lib-express'

export const getLimits = async (org: Organization) => {
let limit: Limits | null = await mongo.limits.findOne({ type: 'organization', id: org.id }, { projection: { _id: 0 } })
Expand Down
4 changes: 2 additions & 2 deletions api/src/oauth-tokens/router.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Router } from 'express'
import { reqUser } from '@data-fair/lib-express'
import { reqUser, httpError } from '@data-fair/lib-express'
import { readOAuthTokens } from '#services'

const router = Router()
export default router

router.get('', async (req, res, next) => {
if (!reqUser(req)) return res.status(401).send()
if (!reqUser(req)?.adminMode) throw httpError(403, )
if (!reqUser(req)?.adminMode) throw httpError(403)
res.send(await readOAuthTokens())
})
1 change: 0 additions & 1 deletion api/types/organization/schema.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import jsonSchema from '@data-fair/lib-utils/json-schema.js'
const ldapParamsSchema = import('../ldap-params/schema.js')

const partialLdapParamsSchema = { ...ldapParamsSchema, required: ['url', 'baseDN'] }
Expand Down
2 changes: 1 addition & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import neostandard from 'neostandard'
import dfLibRecommended from '@data-fair/lib-utils/eslint/recommended.js'

export default [
{ ignores: ['ui/*', '**/.type/'] },
{ ignores: ['ui/*', '**/.type/', 'data/*'] },
...dfLibRecommended,
...neostandard({ ts: true })
]
12 changes: 6 additions & 6 deletions ui/src/components/add-department-menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
:close-on-content-click="false"
offset-y
>
<template #activator="{on}">
<template #activator="{props}">
<v-btn
:title="$t('pages.organization.addDepartment', {departmentLabel: departmentLabel.toLowerCase()})"
fab
small
size="small"
color="primary"
class="mx-2"
v-on="on"
v-bind="props"
>
<v-icon>mdi-plus</v-icon>
</v-btn>
Expand All @@ -36,8 +36,8 @@
:rules="[v => !!v || '']"
name="name"
required
dense
outlined
density="compact"
variant="outlined"
autocomplete="off"
@keyup.enter="confirmCreate"
/>
Expand All @@ -46,7 +46,7 @@
<v-card-actions>
<v-spacer />
<v-btn
text
variant="text"
@click="menu = false"
>
{{ $t('common.confirmCancel') }}
Expand Down
28 changes: 14 additions & 14 deletions ui/src/components/add-member-menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
:close-on-content-click="false"
offset-y
>
<template #activator="{on}">
<template #activator="{props}">
<v-btn
:title="$t('pages.organization.addMember')"
fab
small
size="small"
color="primary"
class="mx-2"
v-on="on"
v-bind="props"
>
<v-icon>mdi-plus</v-icon>
</v-btn>
Expand Down Expand Up @@ -51,8 +51,8 @@
:rules="[v => !!v || '']"
name="email"
required
outlined
dense
variant="outlined"
density="compact"
autocomplete="off"
/>
<v-select
Expand All @@ -61,20 +61,20 @@
:label="$t('common.role')"
:rules="[v => !!v || '']"
name="role"
outlined
dense
variant="outlined"
density="compact"
/>
<v-autocomplete
v-if="env.manageDepartments && orga.departments && orga.departments.length && !department"
v-model="invitation.department"
:items="orga.departments"
:label="orga.departmentLabel || $t('common.department')"
item-value="id"
item-text="name"
item-title="name"
name="department"
clearable
outlined
dense
variant="outlined"
density="compact"
/>
<v-select
v-if="env.manageSites && redirects && redirects.filter(r => r.value !== defaultRedirect).length"
Expand All @@ -84,14 +84,14 @@
:items="redirects"
name="host"
required
dense
outlined
density="compact"
variant="outlined"
/>
</v-form>
<v-alert
:value="!!link"
type="warning"
outlined
variant="outlined"
>
<p>{{ $t('pages.organization.inviteLink') }}</p>
<p style="word-break: break-all;">
Expand All @@ -103,7 +103,7 @@
<v-spacer />
<v-btn
v-if="!link"
text
variant="text"
@click="menu=false"
>
{{ $t('common.confirmCancel') }}
Expand Down
14 changes: 7 additions & 7 deletions ui/src/components/add-organization-menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
v-model="menu"
:close-on-content-click="false"
>
<template #activator="{on}">
<template #activator="{props}">
<v-btn
:title="$t('common.createOrganization')"
color="primary"
text
v-on="on"
variant="text"
v-bind="props"
>
{{ $t('common.createOrganization') }}
</v-btn>
Expand All @@ -33,23 +33,23 @@
:rules="[v => !!v || '', v => v.length < 150 || $t('common.tooLong')]"
name="name"
required
outlined
dense
variant="outlined"
density="compact"
autocomplete="off"
/>
<v-textarea
v-model="editOrganization.description"
:label="$t('common.description')"
name="description"
outlined
variant="outlined"
autocomplete="off"
/>
</v-form>
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn
text
variant="text"
@click="menu = false"
>
{{ $t('common.confirmCancel') }}
Expand Down
20 changes: 10 additions & 10 deletions ui/src/components/add-partner-menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
:close-on-content-click="false"
offset-y
>
<template #activator="{on}">
<template #activator="{props}">
<v-btn
:title="$t('pages.organization.addPartner')"
fab
small
size="small"
color="primary"
class="mx-2"
v-on="on"
v-bind="props"
>
<v-icon>mdi-plus</v-icon>
</v-btn>
Expand All @@ -37,8 +37,8 @@
:rules="[v => !!v || '']"
name="name"
required
dense
outlined
density="compact"
variant="outlined"
autocomplete="off"
/>
<v-text-field
Expand All @@ -47,8 +47,8 @@
:rules="[v => !!v || '']"
name="contactEmail"
required
dense
outlined
density="compact"
variant="outlined"
autocomplete="off"
/>
<v-select
Expand All @@ -58,15 +58,15 @@
:items="redirects"
name="host"
required
dense
outlined
density="compact"
variant="outlined"
/>
</v-form>
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn
text
variant="text"
@click="menu = false"
>
{{ $t('common.confirmCancel') }}
Expand Down
12 changes: 6 additions & 6 deletions ui/src/components/auth-providers-login-links.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
:color="env.theme.colors.primary"
:href="mainSiteLoginUrl"
dark
small
size="small"
rounded
depressed
class="pl-0 pr-3 mr-2 mb-1 text-none white--text"
variant="flat"
class="pl-0 pr-3 mr-2 mb-1 text-none text-white"
>
<v-avatar
size="28"
Expand All @@ -33,10 +33,10 @@
:color="contrastColor(authProvider.color)"
:href="loginURL(authProvider)"
dark
small
size="small"
rounded
depressed
class="pl-0 pr-3 mr-2 mb-1 text-none white--text"
variant="flat"
class="pl-0 pr-3 mr-2 mb-1 text-none text-white"
>
<v-avatar
size="27"
Expand Down
4 changes: 2 additions & 2 deletions ui/src/components/cancel-deletion.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
<v-alert
:value="true"
type="warning"
outlined
variant="outlined"
>
{{ $t('errors.plannedDeletion', {name: userDetails.name, plannedDeletion: $d(new Date(userDetails.plannedDeletion))}) }}
</v-alert>

<v-btn
color="warning"
text
variant="text"
@click="cancelDeletion"
>
{{ $t('pages.login.cancelDeletion') }}
Expand Down
4 changes: 2 additions & 2 deletions ui/src/components/change-host.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div v-if="user">
<v-alert
color="warning"
outlined
variant="outlined"
>
Le compte {{ user.email }} n'existe pas sur {{ host }} mais il existe sur {{ mainHost }}.
</v-alert>
Expand All @@ -27,7 +27,7 @@
<v-spacer />
<v-btn
color="warning"
depressed
variant="flat"
:disabled="!confirmMigration"
@click="confirmChangeHost"
>
Expand Down
12 changes: 6 additions & 6 deletions ui/src/components/confirm-menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
:close-on-content-click="false"
max-width="600"
offset-y
top
location="top"
>
<template #activator="{ on, attrs }">
<template #activator="{ props }">
<!--<v-tooltip v-if="icon" top>
<template v-slot:activator="{ on: onTooltip }">
<v-btn
Expand All @@ -26,8 +26,8 @@
>
<v-btn
:color="yesColor"
v-bind="attrs"
v-on="on"

v-bind="props"
>
{{ buttonText }}
</v-btn>
Expand All @@ -42,7 +42,7 @@
v-if="alert"
:value="true"
:type="yesColor"
outlined
variant="outlined"
>
{{ alert }}
</v-alert>
Expand All @@ -57,7 +57,7 @@
<v-card-actions>
<v-spacer />
<v-btn
text
variant="text"
@click="menu = false"
>
{{ $t('common.confirmCancel') }}
Expand Down
Loading

0 comments on commit 7de355e

Please sign in to comment.