Seperated plugin and api types into subprojects #2

Merged
crimsen merged 10 commits from seperate_plugins into develop 2021-05-26 12:12:48 +00:00
22 changed files with 35 additions and 290 deletions
Showing only changes of commit f9c9f6efbe - Show all commits

View File

@ -2,8 +2,8 @@
"private": true, "private": true,
"license": "MIT", "license": "MIT",
"version": "2.0.0-alpha.1", "version": "2.0.0-alpha.1",
"productName": "Flaschengeist", "productName": "flaschengeist-frontend",
"name": "flaschengeist-frontend", "name": "flaschengeist",
"author": "Tim Gröger <flaschengeist@wu5.de>", "author": "Tim Gröger <flaschengeist@wu5.de>",
"homepage": "https://flaschengeist.dev/Flaschengeist", "homepage": "https://flaschengeist.dev/Flaschengeist",
"description": "Modular student club administration system", "description": "Modular student club administration system",
@ -21,6 +21,7 @@
"quasar": "^2.0.0-beta.17" "quasar": "^2.0.0-beta.17"
}, },
"devDependencies": { "devDependencies": {
"@flaschengeist/typings": "file:../flaschengeist-typings",
"@quasar/app": "^3.0.0-beta.25", "@quasar/app": "^3.0.0-beta.25",
"@quasar/extras": "^1.10.4", "@quasar/extras": "^1.10.4",
"@quasar/quasar-app-extension-qcalendar": "4.0.0-alpha.8", "@quasar/quasar-app-extension-qcalendar": "4.0.0-alpha.8",

View File

@ -1,10 +1,10 @@
import { boot } from 'quasar/wrappers'; import { Notify } from 'quasar';
import { FG_Plugin } from 'src/plugins';
import routes from 'src/router/routes';
import { api } from 'boot/axios'; import { api } from 'boot/axios';
import { boot } from 'quasar/wrappers';
import routes from 'src/router/routes';
import { AxiosResponse } from 'axios'; import { AxiosResponse } from 'axios';
import { RouteRecordRaw } from 'vue-router'; import { RouteRecordRaw } from 'vue-router';
import { Notify } from 'quasar'; import { FG_Plugin } from '@flaschengeist/typings';
const config: { [key: string]: Array<string> } = { const config: { [key: string]: Array<string> } = {
// Do not change required Modules !! // Do not change required Modules !!

View File

@ -35,7 +35,7 @@
<script lang="ts"> <script lang="ts">
import { defineComponent, PropType, computed } from 'vue'; import { defineComponent, PropType, computed } from 'vue';
import { formatDateTime } from 'src/utils/datetime'; import { formatDateTime } from 'src/utils/datetime';
import { FG_Plugin } from 'src/plugins'; import { FG_Plugin } from '@flaschengeist/typings';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
export default defineComponent({ export default defineComponent({

View File

@ -31,7 +31,7 @@
<script lang="ts"> <script lang="ts">
import { computed, defineComponent, PropType } from 'vue'; import { computed, defineComponent, PropType } from 'vue';
import { hasPermissions } from 'src/utils/permission'; import { hasPermissions } from 'src/utils/permission';
import { FG_Plugin } from 'src/plugins'; import { FG_Plugin } from '@flaschengeist/typings';
export default defineComponent({ export default defineComponent({
name: 'EssentialExpansionLink', name: 'EssentialExpansionLink',

View File

@ -13,7 +13,7 @@
<script lang="ts"> <script lang="ts">
import { computed, defineComponent, PropType } from 'vue'; import { computed, defineComponent, PropType } from 'vue';
import { hasPermissions } from 'src/utils/permission'; import { hasPermissions } from 'src/utils/permission';
import { FG_Plugin } from 'src/plugins'; import { FG_Plugin } from '@flaschengeist/typings';
export default defineComponent({ export default defineComponent({
name: 'EssentialLink', name: 'EssentialLink',

View File

@ -9,7 +9,7 @@
<script lang="ts"> <script lang="ts">
import { computed, defineComponent, PropType } from 'vue'; import { computed, defineComponent, PropType } from 'vue';
import { hasPermissions } from 'src/utils/permission'; import { hasPermissions } from 'src/utils/permission';
import { FG_Plugin } from 'src/plugins'; import { FG_Plugin } from '@flaschengeist/typings';
export default defineComponent({ export default defineComponent({
name: 'ShortcutLink', name: 'ShortcutLink',

137
src/flaschengeist.d.ts vendored
View File

@ -1,137 +0,0 @@
declare namespace FG {
interface Notification {
id: number;
plugin: string;
text: string;
data?: unknown;
time: Date;
}
interface User {
userid: string;
display_name: string;
firstname: string;
lastname: string;
mail: string;
birthday?: Date;
roles: Array<string>;
permissions?: Array<string>;
avatar_url?: string;
}
interface Session {
expires: Date;
token: string;
lifetime: number;
browser: string;
platform: string;
userid: string;
}
type Permission = string;
interface Role {
id: number;
name: string;
permissions: Array<Permission>;
}
interface Transaction {
id: number;
time: Date;
amount: number;
reversal_id?: number;
author_id?: string;
sender_id?: string;
original_id?: number;
receiver_id?: string;
}
interface Event {
id: number;
start: Date;
end?: Date;
name?: string;
description?: string;
type: EventType | number;
is_template: boolean;
jobs: Array<Job>;
}
interface EventType {
id: number;
name: string;
}
interface Invite {
id: number;
job_id: number;
invitee_id: string;
sender_id: string;
}
interface Job {
id: number;
start: Date;
end?: Date;
type: JobType | number;
comment?: string;
services: Array<Service>;
required_services: number;
}
interface JobType {
id: number;
name: string;
}
interface Service {
userid: string;
is_backup: boolean;
value: number;
}
interface Drink {
id: number;
article_id?: string;
package_size?: number;
name: string;
volume?: number;
cost_per_volume?: number;
cost_per_package?: number;
tags?: Array<Tag>;
type?: DrinkType;
volumes: Array<DrinkPriceVolume>;
uuid: string;
receipt?: Array<string>;
}
interface DrinkIngredient {
id: number;
volume: number;
ingredient_id: number;
}
interface DrinkPrice {
id: number;
price: number;
public: boolean;
description?: string;
}
interface DrinkPriceVolume {
id: number;
volume: number;
min_prices: Array<MinPrices>;
prices: Array<DrinkPrice>;
ingredients: Array<Ingredient>;
}
interface DrinkType {
id: number;
name: string;
}
interface ExtraIngredient {
id: number;
name: string;
price: number;
}
interface Ingredient {
id: number;
drink_ingredient?: DrinkIngredient;
extra_ingredient?: ExtraIngredient;
}
interface MinPrices {
percentage: number;
price: number;
}
interface Tag {
id: number;
name: string;
color: string;
}
}

View File

@ -86,11 +86,11 @@ import {
onBeforeUnmount, onBeforeUnmount,
ComponentPublicInstance, ComponentPublicInstance,
} from 'vue'; } from 'vue';
import { useMainStore } from 'src/stores';
import { FG_Plugin } from 'src/plugins';
import { useRouter } from 'vue-router';
import { Screen } from 'quasar'; import { Screen } from 'quasar';
import config from 'src/config'; import config from 'src/config';
import { useRouter } from 'vue-router';
import { useMainStore } from 'src/stores';
import { FG_Plugin } from '@flaschengeist/typings';
import EssentialExpansionLink from 'components/navigation/EssentialExpansionLink.vue'; import EssentialExpansionLink from 'components/navigation/EssentialExpansionLink.vue';
import draggable from 'vuedraggable'; import draggable from 'vuedraggable';
const drag: ComponentPublicInstance = <ComponentPublicInstance>draggable; const drag: ComponentPublicInstance = <ComponentPublicInstance>draggable;

View File

@ -25,8 +25,8 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { FG_Plugin } from 'src/plugins';
import { defineComponent, inject } from 'vue'; import { defineComponent, inject } from 'vue';
import { FG_Plugin } from '@flaschengeist/typings';
import ShortcutLink from 'components/navigation/ShortcutLink.vue'; import ShortcutLink from 'components/navigation/ShortcutLink.vue';
export default defineComponent({ export default defineComponent({

View File

@ -13,7 +13,7 @@
<script lang="ts"> <script lang="ts">
import { computed, defineComponent, inject } from 'vue'; import { computed, defineComponent, inject } from 'vue';
import { hasPermissions } from 'src/utils/permission'; import { hasPermissions } from 'src/utils/permission';
import { FG_Plugin } from 'src/plugins'; import { FG_Plugin } from '@flaschengeist/typings';
export default defineComponent({ export default defineComponent({
name: 'Dashboard', name: 'Dashboard',

View File

@ -60,8 +60,8 @@
<script lang="ts"> <script lang="ts">
import { defineComponent, inject } from 'vue'; import { defineComponent, inject } from 'vue';
import { FG_Plugin } from '@flaschengeist/typings';
import Developer from 'components/about/Developer.vue'; import Developer from 'components/about/Developer.vue';
import { FG_Plugin } from 'src/plugins';
const developers = [ const developers = [
{ {
@ -69,8 +69,7 @@ const developers = [
lastname: 'Gröger', lastname: 'Gröger',
club: 'Studentenclub Wu5 e.V.', club: 'Studentenclub Wu5 e.V.',
job: 'Gründer von Flaschengeist; Maintainer', job: 'Gründer von Flaschengeist; Maintainer',
pic: pic: 'https://scontent-frt3-2.xx.fbcdn.net/v/t1.0-9/31768724_1663023210401956_3834323197281435648_n.jpg?_nc_cat=109&_nc_sid=09cbfe&_nc_ohc=jWvUfn_xJ9YAX_oJ3CE&_nc_ht=scontent-frt3-2.xx&oh=15249378051f1e27f8b15122effb5c4a&oe=5FAC6A17',
'https://scontent-frt3-2.xx.fbcdn.net/v/t1.0-9/31768724_1663023210401956_3834323197281435648_n.jpg?_nc_cat=109&_nc_sid=09cbfe&_nc_ohc=jWvUfn_xJ9YAX_oJ3CE&_nc_ht=scontent-frt3-2.xx&oh=15249378051f1e27f8b15122effb5c4a&oe=5FAC6A17',
description: description:
'Eigentlich wöllte ich jetzt hier echt viel hinschreiben. Aber ich habe keinen Plan was. Früher war ich einfach nur Tim G. und habe für andere den Kaffe geholt. Unter anderen für Ferdinand Thiessen.', 'Eigentlich wöllte ich jetzt hier echt viel hinschreiben. Aber ich habe keinen Plan was. Früher war ich einfach nur Tim G. und habe für andere den Kaffe geholt. Unter anderen für Ferdinand Thiessen.',
}, },
@ -78,8 +77,7 @@ const developers = [
firstname: 'Ferdinand', firstname: 'Ferdinand',
lastname: 'Thiessen', lastname: 'Thiessen',
club: 'Club Aquarium e.V.', club: 'Club Aquarium e.V.',
pic: pic: 'https://scontent-frx5-1.xx.fbcdn.net/v/t1.0-9/17022243_1418942461493397_9069541318944803902_n.jpg?_nc_cat=110&_nc_sid=174925&_nc_ohc=HjkSm8vcRW8AX8bTnJ8&_nc_ht=scontent-frx5-1.xx&oh=f09bd36525f3c6e55feaafb3b05b43d2&oe=5FAD432A',
'https://scontent-frx5-1.xx.fbcdn.net/v/t1.0-9/17022243_1418942461493397_9069541318944803902_n.jpg?_nc_cat=110&_nc_sid=174925&_nc_ohc=HjkSm8vcRW8AX8bTnJ8&_nc_ht=scontent-frx5-1.xx&oh=f09bd36525f3c6e55feaafb3b05b43d2&oe=5FAD432A',
job: 'Backend-Developer; Co-Maintainer', job: 'Backend-Developer; Co-Maintainer',
description: description:
'Geiler Typ. Einfach mal so alles Aufgeräumt. Aufeinmal könnte man aus dem Code eine Dokumentation zaubern!', 'Geiler Typ. Einfach mal so alles Aufgeräumt. Aufeinmal könnte man aus dem Code eine Dokumentation zaubern!',
@ -90,8 +88,7 @@ const developers = [
club: 'Studentenclub Wu5 e.V.', club: 'Studentenclub Wu5 e.V.',
job: 'Eigentlich Frontend-Developer', job: 'Eigentlich Frontend-Developer',
description: 'Er findet sich langsam rein.', description: 'Er findet sich langsam rein.',
pic: pic: 'https://scontent-frt3-1.xx.fbcdn.net/v/t31.0-8/10363433_647611335326483_3447118968375865826_o.jpg?_nc_cat=104&_nc_sid=09cbfe&_nc_ohc=nWMgo-6Ih74AX_NiGUz&_nc_ht=scontent-frt3-1.xx&oh=f16d2edfe86f68d54900099087edb9c9&oe=5FAACFD4',
'https://scontent-frt3-1.xx.fbcdn.net/v/t31.0-8/10363433_647611335326483_3447118968375865826_o.jpg?_nc_cat=104&_nc_sid=09cbfe&_nc_ohc=nWMgo-6Ih74AX_NiGUz&_nc_ht=scontent-frt3-1.xx&oh=f16d2edfe86f68d54900099087edb9c9&oe=5FAACFD4',
}, },
]; ];
export default defineComponent({ export default defineComponent({

117
src/plugins.d.ts vendored
View File

@ -1,117 +0,0 @@
import { RouteLocationRaw, RouteRecordRaw, RouteRecordName } from 'vue-router';
import { Component } from 'vue';
declare namespace FG_Plugin {
/**
* Interface defining a Flaschengeist plugin
*/
interface Plugin {
name: string;
version: string;
widgets: Widget[];
/** Pther frontend modules needed for this plugin to work correctly */
requiredModules: string[];
/** Backend modules needed for this plugin to work correctly */
requiredBackendModules: string[];
/** Menu entries for authenticated users */
innerRoutes?: MenuRoute[];
/** Public menu entries (without authentification) */
outerRoutes?: MenuRoute[];
/** Routes without menu links, for internal usage */
internalRoutes?: NamedRouteRecordRaw[];
/** Handle notifications, defaults to boot/plugins.ts:translateNotification() */
notification?(msg: FG.Notification): FG_Plugin.Notification;
}
/**
* Defines the loaded state of the Flaschengeist
*/
interface Flaschengeist {
/** All loaded plugins */
plugins: LoadedPlugin[];
/** All routes, combined from all plugins */
routes: RouteRecordRaw[];
/** All menu entries */
menuLinks: MenuLink[];
/** All inner shortcuts */
shortcuts: Shortcut[];
/** All outer shortcuts */
outerShortcuts: Shortcut[];
/** All widgets */
widgets: Widget[];
}
/**
* Interface for a frontend notification
*/
interface Notification extends FG.Notification {
/** If set a button for accepting will be shown, this function will get called before deleting the notification */
accept?(): Promise<void>;
/** If set this function is called before the notification gets deleted */
reject?(): Promise<void>;
/** If set the notification text is interpreted as a link to this location */
link?: RouteLocationRaw;
/** If set this icon is used */
icon?: string;
}
/**
* Loaded Flaschengeist plugin
*/
interface LoadedPlugin {
name: string;
version: string;
notification(msg: FG.Notification): FG_Plugin.Notification;
}
/**
* Defines a shortcut link
*/
interface Shortcut {
link: RouteRecordName;
icon: string;
permissions?: string[];
}
/**
* Defines a main menu entry along with the route
* Used when defining a plugin
*/
interface MenuRoute extends MenuEntry {
route: NamedRouteRecordRaw;
shortcut?: boolean;
children?: this[];
}
type NamedRouteRecordRaw = RouteRecordRaw & {
name: RouteRecordName;
};
/**
* Defines a menu entry in the main menu
*/
interface MenuLink extends MenuEntry {
/** Name of the target route */
link: RouteRecordName;
}
/**
* Base interface for internal use
*/
interface MenuEntry {
title: string | (() => string);
icon: string;
permissions?: string[];
children?: this[];
}
/**
* Widget object for the dashboard
*/
interface Widget {
name: string;
priority: number;
permissions: FG.Permission[];
widget: Component;
}
}

View File

@ -1,6 +1,6 @@
import routes from './routes'; import { FG_Plugin } from '@flaschengeist/typings';
import { FG_Plugin } from 'src/plugins';
import { defineAsyncComponent } from 'vue'; import { defineAsyncComponent } from 'vue';
import routes from './routes';
const plugin: FG_Plugin.Plugin = { const plugin: FG_Plugin.Plugin = {
name: 'Balance', name: 'Balance',

View File

@ -1,4 +1,4 @@
import { FG_Plugin } from 'src/plugins'; import { FG_Plugin } from '@flaschengeist/typings';
import permissions from '../permissions'; import permissions from '../permissions';
const mainRoutes: FG_Plugin.MenuRoute[] = [ const mainRoutes: FG_Plugin.MenuRoute[] = [

View File

@ -1,5 +1,5 @@
import { innerRoutes, outerRoutes } from './routes'; import { innerRoutes, outerRoutes } from './routes';
import { FG_Plugin } from 'src/plugins'; import { FG_Plugin } from '@flaschengeist/typings';
const plugin: FG_Plugin.Plugin = { const plugin: FG_Plugin.Plugin = {
name: 'Pricelist', name: 'Pricelist',

View File

@ -1,4 +1,4 @@
import { FG_Plugin } from 'src/plugins'; import { FG_Plugin } from '@flaschengeist/typings';
export const innerRoutes: FG_Plugin.MenuRoute[] = [ export const innerRoutes: FG_Plugin.MenuRoute[] = [
{ {

View File

@ -1,6 +1,6 @@
import { defineAsyncComponent } from 'vue';
import { innerRoutes, privateRoutes } from './routes'; import { innerRoutes, privateRoutes } from './routes';
import { FG_Plugin } from 'src/plugins'; import { FG_Plugin } from '@flaschengeist/typings';
import { defineAsyncComponent } from 'vue';
const plugin: FG_Plugin.Plugin = { const plugin: FG_Plugin.Plugin = {
name: 'Schedule', name: 'Schedule',

View File

@ -1,4 +1,4 @@
import { FG_Plugin } from 'src/plugins'; import { FG_Plugin } from '@flaschengeist/typings';
import { PERMISSIONS } from '../permissions'; import { PERMISSIONS } from '../permissions';
export const innerRoutes: FG_Plugin.MenuRoute[] = [ export const innerRoutes: FG_Plugin.MenuRoute[] = [

View File

@ -1,6 +1,6 @@
import routes from './routes'; import { FG_Plugin } from '@flaschengeist/typings';
import { FG_Plugin } from 'src/plugins';
import { defineAsyncComponent } from 'vue'; import { defineAsyncComponent } from 'vue';
import routes from './routes';
const plugin: FG_Plugin.Plugin = { const plugin: FG_Plugin.Plugin = {
name: 'User', name: 'User',

View File

@ -1,4 +1,4 @@
import { FG_Plugin } from 'src/plugins'; import { FG_Plugin } from '@flaschengeist/typings';
import { useMainStore } from 'src/stores'; import { useMainStore } from 'src/stores';
const mainRoutes: FG_Plugin.MenuRoute[] = [ const mainRoutes: FG_Plugin.MenuRoute[] = [

View File

@ -1,7 +1,7 @@
import { useUserStore, useSessionStore } from 'src/plugins/user/store'; import { useUserStore, useSessionStore } from 'src/plugins/user/store';
import { translateNotification } from 'src/boot/plugins'; import { translateNotification } from 'src/boot/plugins';
import { LocalStorage, SessionStorage } from 'quasar'; import { LocalStorage, SessionStorage } from 'quasar';
import { FG_Plugin } from 'src/plugins'; import { FG_Plugin } from '@flaschengeist/typings';
import { AxiosResponse } from 'axios'; import { AxiosResponse } from 'axios';
import { api } from 'src/boot/axios'; import { api } from 'src/boot/axios';
import { defineStore } from 'pinia'; import { defineStore } from 'pinia';

View File

@ -8,9 +8,10 @@
"dom" "dom"
], ],
"types": [ "types": [
"@flaschengeist/typings",
"@quasar/app",
"node", "node",
"webpack-env", "webpack-env"
"@quasar/app"
] ]
} }
} }