feat: Extend apps with further data
This commit is contained in:
@@ -7,7 +7,7 @@ const queryType = new GraphQLObjectType({
|
||||
name: 'Query',
|
||||
fields: {
|
||||
getApps: {
|
||||
type: GraphQLList(GraphQLString),
|
||||
type: GraphQLList(appType),
|
||||
args: {
|
||||
name: { type: GraphQLString }
|
||||
},
|
||||
|
@@ -7,6 +7,7 @@ const appType = new GraphQLObjectType({
|
||||
name: { type: GraphQLString },
|
||||
iconUrl: { type: GraphQLString },
|
||||
docUrl: { type: GraphQLString },
|
||||
primaryColor: { type: GraphQLString },
|
||||
fields: { type: GraphQLList(fieldType) }
|
||||
}
|
||||
});
|
||||
|
@@ -1,12 +1,15 @@
|
||||
import fs from 'fs';
|
||||
|
||||
class App {
|
||||
static folderPath = __dirname + '/../apps'
|
||||
static folderPath = __dirname + '/../apps';
|
||||
static list = fs.readdirSync(this.folderPath);
|
||||
|
||||
static findAll(name?: string): string[] {
|
||||
if(!name) return this.list;
|
||||
return this.list.filter((app) => app.includes(name.toLowerCase()));
|
||||
static findAll(name?: string): object[] {
|
||||
if(!name) return this.list.map((name) => this.findOneByName(name));
|
||||
|
||||
return this.list
|
||||
.filter((app) => app.includes(name.toLowerCase()))
|
||||
.map((name) => this.findOneByName(name));
|
||||
}
|
||||
|
||||
static findOneByName(name: string): object {
|
||||
|
Reference in New Issue
Block a user