mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-01-27 01:50:26 +01:00
Lint project
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import axios, { AxiosRequestConfig, AxiosResponse } from 'axios'
|
||||
import type { AxiosRequestConfig, AxiosResponse } from 'axios'
|
||||
import axios from 'axios'
|
||||
import Env from '@ioc:Adonis/Core/Env'
|
||||
import Redis from '@ioc:Adonis/Addons/Redis'
|
||||
import { SpotifyArtist, SpotifyTrack } from 'App/Types/ILocalSpotify'
|
||||
import { Artist, InternalPlayerResponse, Item, PlayerResponse, SpotifyToken } from 'App/Types/ISpotify'
|
||||
import type { SpotifyArtist, SpotifyTrack } from 'App/Types/ILocalSpotify'
|
||||
import type { Artist, InternalPlayerResponse, Item, PlayerResponse, SpotifyToken } from 'App/Types/ISpotify'
|
||||
import queryString from 'query-string'
|
||||
import { updateGithubReadmeSpotify } from 'App/Utils/UpdateGithubReadme'
|
||||
|
||||
@@ -12,9 +13,9 @@ export async function getSpotifyAccount(): Promise<SpotifyToken> {
|
||||
return await Redis.exists('spotify:account')
|
||||
? JSON.parse(await Redis.get('spotify:account') || '{}')
|
||||
: {
|
||||
access_token: '',
|
||||
refresh_token: '',
|
||||
}
|
||||
access_token: '',
|
||||
refresh_token: '',
|
||||
}
|
||||
}
|
||||
|
||||
export async function setSpotifyAccount(token: SpotifyToken): Promise<void> {
|
||||
@@ -103,7 +104,8 @@ export async function getCurrentPlayingFromCache(): Promise<InternalPlayerRespon
|
||||
}
|
||||
|
||||
export async function getCurrentPlayingFromSpotify(): Promise<InternalPlayerResponse> {
|
||||
if ((await getSpotifyAccount()).access_token === '') return { is_playing: false }
|
||||
if ((await getSpotifyAccount()).access_token === '')
|
||||
return { is_playing: false }
|
||||
const current_track = await RequestWrapper<PlayerResponse>('https://api.spotify.com/v1/me/player?additional_types=track,episode')
|
||||
|
||||
let current: InternalPlayerResponse
|
||||
|
||||
@@ -3,11 +3,11 @@ import axios from 'axios'
|
||||
import Env from '@ioc:Adonis/Core/Env'
|
||||
import Redis from '@ioc:Adonis/Addons/Redis'
|
||||
import Logger from '@ioc:Adonis/Core/Logger'
|
||||
import { StatesResponse } from 'App/Types/IStates'
|
||||
import type { StatesResponse } from 'App/Types/IStates'
|
||||
|
||||
export async function fetchDevelopingState(): Promise<void> {
|
||||
try {
|
||||
const response = await axios.get<{ data: StatesResponse[]}>(`https://wakatime.com/api/v1/users/${Env.get('WAKATIME_USER')}/heartbeats`, {
|
||||
const response = await axios.get<{ data: StatesResponse[] }>(`https://wakatime.com/api/v1/users/${Env.get('WAKATIME_USER')}/heartbeats`, {
|
||||
headers: {
|
||||
Authorization: `Basic ${btoa(Env.get('WAKATIME_KEY'))}`,
|
||||
},
|
||||
@@ -26,7 +26,8 @@ export async function fetchDevelopingState(): Promise<void> {
|
||||
|
||||
if (redis_state !== active) {
|
||||
await Redis.set('states:developing', String(active))
|
||||
if (redis_state) await Redis.set('states:sleeping', 'false')
|
||||
if (redis_state)
|
||||
await Redis.set('states:sleeping', 'false')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import DevelopmentHour from 'App/Models/DevelopmentHour'
|
||||
import CommandsRun from 'App/Models/CommandsRun'
|
||||
import BuildsRun from 'App/Models/BuildsRun'
|
||||
import { Stats, Time } from 'App/Types/IStats'
|
||||
import type { Stats, Time } from 'App/Types/IStats'
|
||||
|
||||
function formatDate(date: Date): string {
|
||||
return date.toISOString().split('T')[0]
|
||||
|
||||
@@ -7,9 +7,9 @@ import {
|
||||
fetchStatistics,
|
||||
fetchWeeklyStatistics,
|
||||
} from 'App/Utils/StatsUtils'
|
||||
import { Stats } from 'App/Types/IStats'
|
||||
import type { Stats } from 'App/Types/IStats'
|
||||
import { getCurrentPlayingFromCache } from 'App/Utils/SongUtils'
|
||||
import { GithubReason, GithubRequest } from 'App/Types/IGithub'
|
||||
import type { GithubReason, GithubRequest } from 'App/Types/IGithub'
|
||||
|
||||
export async function updateGithubReadmeStats(): Promise<void> {
|
||||
const daily_stats = await fetchDailyStatistics()
|
||||
@@ -84,9 +84,9 @@ async function getReadmeContent(): Promise<GithubRequest | null> {
|
||||
})
|
||||
return response.status === 200
|
||||
? {
|
||||
content: Buffer.from(response.data.content, 'base64').toString(),
|
||||
sha: response.data.sha,
|
||||
}
|
||||
content: Buffer.from(response.data.content, 'base64').toString(),
|
||||
sha: response.data.sha,
|
||||
}
|
||||
: null
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user