forked from mystiq/hydrogen-web
Migrate InviteStore.js to TypeScript.
This commit is contained in:
parent
7c56ac7746
commit
7de704ef86
2 changed files with 23 additions and 5 deletions
|
@ -19,7 +19,7 @@ import {StorageError} from "../common";
|
||||||
import {Store} from "./Store";
|
import {Store} from "./Store";
|
||||||
import {SessionStore} from "./stores/SessionStore";
|
import {SessionStore} from "./stores/SessionStore";
|
||||||
import {RoomSummaryStore} from "./stores/RoomSummaryStore";
|
import {RoomSummaryStore} from "./stores/RoomSummaryStore";
|
||||||
import {InviteStore} from "./stores/InviteStore.js";
|
import {InviteStore} from "./stores/InviteStore";
|
||||||
import {TimelineEventStore} from "./stores/TimelineEventStore.js";
|
import {TimelineEventStore} from "./stores/TimelineEventStore.js";
|
||||||
import {TimelineRelationStore} from "./stores/TimelineRelationStore.js";
|
import {TimelineRelationStore} from "./stores/TimelineRelationStore.js";
|
||||||
import {RoomStateStore} from "./stores/RoomStateStore.js";
|
import {RoomStateStore} from "./stores/RoomStateStore.js";
|
||||||
|
|
|
@ -13,21 +13,39 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
import {Store} from "../Store";
|
||||||
|
import {MemberData} from "./RoomMemberStore";
|
||||||
|
|
||||||
|
// TODO: Move to Invite when that's TypeScript.
|
||||||
|
export interface InviteData {
|
||||||
|
roomId: string;
|
||||||
|
isEncrypted: boolean;
|
||||||
|
isDirectMessage: boolean;
|
||||||
|
name?: string;
|
||||||
|
avatarUrl?: string;
|
||||||
|
avatarColorId: number;
|
||||||
|
canonicalAlias?: string;
|
||||||
|
timestamp: number;
|
||||||
|
joinRule: string;
|
||||||
|
inviter?: MemberData;
|
||||||
|
}
|
||||||
|
|
||||||
export class InviteStore {
|
export class InviteStore {
|
||||||
constructor(inviteStore) {
|
private _inviteStore: Store<InviteData>;
|
||||||
|
|
||||||
|
constructor(inviteStore: Store<InviteData>) {
|
||||||
this._inviteStore = inviteStore;
|
this._inviteStore = inviteStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
getAll() {
|
getAll(): Promise<InviteData[]> {
|
||||||
return this._inviteStore.selectAll();
|
return this._inviteStore.selectAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
set(invite) {
|
set(invite: InviteData): Promise<IDBValidKey> {
|
||||||
return this._inviteStore.put(invite);
|
return this._inviteStore.put(invite);
|
||||||
}
|
}
|
||||||
|
|
||||||
remove(roomId) {
|
remove(roomId: string): void {
|
||||||
this._inviteStore.delete(roomId);
|
this._inviteStore.delete(roomId);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue