send removePasswordWithServer and model updates (#242)
This commit is contained in:
parent
1420082348
commit
afa01f67f4
|
@ -19,4 +19,5 @@ export abstract class SendService {
|
|||
clear: (userId: string) => Promise<any>;
|
||||
delete: (id: string | string[]) => Promise<any>;
|
||||
deleteWithServer: (id: string) => Promise<any>;
|
||||
removePasswordWithServer: (id: string) => Promise<any>;
|
||||
}
|
||||
|
|
|
@ -46,4 +46,22 @@ export class SendView implements View {
|
|||
get urlB64Key(): string {
|
||||
return Utils.fromBufferToUrlB64(this.key);
|
||||
}
|
||||
|
||||
get maxAccessCountReached(): boolean {
|
||||
if (this.maxAccessCount == null) {
|
||||
return false;
|
||||
}
|
||||
return this.accessCount >= this.maxAccessCount;
|
||||
}
|
||||
|
||||
get expired(): boolean {
|
||||
if (this.expirationDate == null) {
|
||||
return false;
|
||||
}
|
||||
return this.expirationDate <= new Date();
|
||||
}
|
||||
|
||||
get pendingDelete(): boolean {
|
||||
return this.deletionDate <= new Date();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -152,7 +152,6 @@ export class SendService implements SendServiceAbstraction {
|
|||
const userId = await this.userService.getUserId();
|
||||
const data = new SendData(response, userId);
|
||||
await this.upsert(data);
|
||||
|
||||
}
|
||||
|
||||
async upsert(send: SendData | SendData[]): Promise<any> {
|
||||
|
@ -215,6 +214,13 @@ export class SendService implements SendServiceAbstraction {
|
|||
await this.delete(id);
|
||||
}
|
||||
|
||||
async removePasswordWithServer(id: string): Promise<any> {
|
||||
const response = await this.apiService.putSendRemovePassword(id);
|
||||
const userId = await this.userService.getUserId();
|
||||
const data = new SendData(response, userId);
|
||||
await this.upsert(data);
|
||||
}
|
||||
|
||||
private parseFile(send: Send, file: File, key: SymmetricCryptoKey): Promise<ArrayBuffer> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const reader = new FileReader();
|
||||
|
|
Loading…
Reference in New Issue