Added backend interfaces

This commit is contained in:
Ferdinand Thiessen 2020-10-21 17:39:04 +02:00
parent e6da94ad0e
commit 05fd255a51
2 changed files with 54 additions and 23 deletions

View File

@ -1,9 +1,32 @@
interface Session {
expires: Date;
token: string;
lifetime: number;
browser: string;
platform: string;
declare namespace FG {
interface Event {
id: number;
begin: Date;
end?: Date;
description: string;
kind: EventKind;
slots: Array<EventSlot>;
}
interface EventKind {
id: number;
name: string;
}
interface EventSlot {
id: number;
start: Date;
end?: any;
slots: Array<any>;
}
interface Job {
userid: string;
value: number;
}
type JobKind = string;
interface JobSlot {
id: number;
needed_persons: number;
kind: JobKind;
jobs: Array<Job>;
}
interface User {
userid: string;
@ -13,8 +36,16 @@ interface User {
mail: string;
roles: Array<Role>;
}
interface Session {
expires: Date;
token: string;
lifetime: number;
browser: string;
platform: string;
}
type Permission = string;
interface Role {
name: string;
permissions: Array<Permission>;
}
}

View File

@ -11,8 +11,8 @@ export interface UserStateInterface extends LoginResponse {
}
export interface LoginResponse {
user: User;
session: Session;
user: FG.User;
session: FG.Session;
}
const state: UserStateInterface = {
@ -35,10 +35,10 @@ const state: UserStateInterface = {
};
const mutations: MutationTree<UserStateInterface> = {
setUser (state, data: User) {
setUser (state, data: FG.User) {
state.user = data;
},
setSession (state, data: Session) {
setSession (state, data: FG.Session) {
state.session = data;
},
setLoginLoading (state, data: boolean) {