command repository added and a lot of other changes

This commit is contained in:
Tobias Kurze
2019-08-13 15:30:57 +02:00
parent 6f0a2af15d
commit 55e2e9f6b9
9 changed files with 4423 additions and 4002 deletions

View File

@@ -4,6 +4,7 @@ import GroupRepository from './groupRepository';
import UserRepository from './userRepository';
import RoomRepository from './roomRepository';
import RecorderRepository from './recorderRepository';
import CommandRepository from './commandRepository';
export default function get(name: string) {
@@ -20,6 +21,9 @@ export default function get(name: string) {
case 'user': {
return UserRepository;
}
case 'command': {
return CommandRepository;
}
default: {
// statements;
break;

View File

@@ -0,0 +1,30 @@
// groupRepository.ts
// @ts-ignore
import Repository from './Repository';
const commandResource = '/command';
import {dictEmptyValToNull} from '@/utils';
export default {
getCommands() {
return Repository.get(`${commandResource}`);
},
getCommand(commandId: number) {
return Repository.get(`${commandResource}/${commandId}`);
},
deleteCommand(commandId: number) {
return Repository.delete(`${commandResource}/${commandId}`);
},
createCommand(commandData: any) {
return Repository.post(`${commandResource}`, dictEmptyValToNull(commandData));
},
updateCommand(commandId: number, commandData: any) {
return Repository.put(`${commandResource}/${commandId}`, dictEmptyValToNull(commandData));
},
};