mirror of
https://github.com/unraid/api.git
synced 2026-01-15 13:10:01 -06:00
feat: flash query endpoint
This commit is contained in:
22
app/graphql/resolvers/query/flash.ts
Normal file
22
app/graphql/resolvers/query/flash.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
/*!
|
||||
* Copyright 2021 Lime Technology Inc. All rights reserved.
|
||||
* Written by: Alexis Tyler
|
||||
*/
|
||||
|
||||
import { varState } from '../../../core/states';
|
||||
import { ensurePermission } from '../../../core/utils';
|
||||
import { Context } from '../../schema/utils';
|
||||
|
||||
export default async (_: unknown, __: unknown, context: Context) => {
|
||||
ensurePermission(context.user, {
|
||||
resource: 'flash',
|
||||
action: 'read',
|
||||
possession: 'any'
|
||||
});
|
||||
|
||||
return {
|
||||
guid: varState.data.flashGuid,
|
||||
vendor: varState.data.flashVendor,
|
||||
product: varState.data.flashProduct
|
||||
};
|
||||
};
|
||||
13
app/graphql/schema/types/flash/flash.graphql
Normal file
13
app/graphql/schema/types/flash/flash.graphql
Normal file
@@ -0,0 +1,13 @@
|
||||
type Query {
|
||||
flash: Flash
|
||||
}
|
||||
|
||||
type Subscription {
|
||||
flash: Flash!
|
||||
}
|
||||
|
||||
type Flash {
|
||||
guid: String
|
||||
vendor: String
|
||||
product: String
|
||||
}
|
||||
Reference in New Issue
Block a user