Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mono424 committed Sep 15, 2023
1 parent 2ebd58a commit 738087a
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 191 deletions.
4 changes: 2 additions & 2 deletions web/ts/api/admin-lecture-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ export type VideoSection = {
startMinutes: number;
startSeconds: number;

streamID?: number;
fileID?: number;
//Pseudo Fields
key: string;
};

export type VideoSectionDelta = {
Expand Down
19 changes: 0 additions & 19 deletions web/ts/api/video-sections.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
import { del, get, post, put } from "../utilities/fetch-wrappers";

export class UpdateVideoSectionRequest {
Description: string;
StartHours: number;
StartMinutes: number;
StartSeconds: number;
}

export type Section = {
ID?: number;
description: string;
Expand All @@ -29,16 +22,4 @@ export const VideoSectionAPI = {
get: async function (streamId: number): Promise<Section[]> {
return get(`/api/stream/${streamId}/sections`);
},

add: async function (streamId: number, request: object) {
return post(`/api/stream/${streamId}/sections`, request);
},

update: function (streamId: number, id: number, request: UpdateVideoSectionRequest) {
return put(`/api/stream/${streamId}/sections/${id}`, request);
},

delete: async function (streamId: number, id: number): Promise<Response> {
return del(`/api/stream/${streamId}/sections/${id}`);
},
};
35 changes: 1 addition & 34 deletions web/ts/data-store/video-sections.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Time } from "../global";
import { StreamableMapProvider } from "./provider";
import { Section, UpdateVideoSectionRequest, VideoSectionAPI } from "../api/video-sections";
import { Section, VideoSectionAPI } from "../api/video-sections";

export class VideoSectionProvider extends StreamableMapProvider<number, Section[]> {
protected async fetcher(streamId: number): Promise<Section[]> {
Expand All @@ -10,37 +10,4 @@ export class VideoSectionProvider extends StreamableMapProvider<number, Section[
return s;
});
}

async add(streamId: number, sections: Section[]): Promise<void> {
await VideoSectionAPI.add(streamId, sections);
await this.fetch(streamId, true);
await this.triggerUpdate(streamId);
}

async delete(streamId: number, sectionId: number) {
await VideoSectionAPI.delete(streamId, sectionId);
this.data[streamId] = (await this.getData(streamId)).filter((s) => s.ID !== sectionId);
}

async update(streamId: number, sectionId: number, request: UpdateVideoSectionRequest) {
await VideoSectionAPI.update(streamId, sectionId, request);
this.data[streamId] = (await this.getData(streamId)).map((s) => {
if (s.ID === sectionId) {
s = {
...s,
startHours: request.StartHours,
startMinutes: request.StartMinutes,
startSeconds: request.StartSeconds,
description: request.Description,
friendlyTimestamp: new Time(
request.StartHours,
request.StartMinutes,
request.StartSeconds,
).toString(),
};
}
return s;
});
await this.triggerUpdate(streamId);
}
}
1 change: 0 additions & 1 deletion web/ts/entry/admins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ export * from "../notification-management";
export * from "../audits";
export * from "../maintenance";
export * from "../change-set";
export { VideoSectionsAdminController, VideoSectionUpdater } from "../video-sections";
1 change: 0 additions & 1 deletion web/ts/entry/video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
export * from "../watch-admin";
export * from "../TUMLiveVjs";
export * from "../watch";
export * from "../video-sections";
export * from "../splitview";
export * from "../bookmarks";
export * from "../subtitle-search";
Expand Down
134 changes: 0 additions & 134 deletions web/ts/video-sections.ts

This file was deleted.

0 comments on commit 738087a

Please sign in to comment.