2018-12-17 16:29:37 +01:00
|
|
|
import { UriMatchType } from "../../enums/uriMatchType";
|
2021-04-21 02:16:19 +02:00
|
|
|
import { EncString } from "../domain/encString";
|
2020-12-03 21:20:38 +01:00
|
|
|
import { LoginUri as LoginUriDomain } from "../domain/loginUri";
|
2022-02-22 15:39:11 +01:00
|
|
|
import { LoginUriView } from "../view/loginUriView";
|
2020-12-03 21:20:38 +01:00
|
|
|
|
2022-04-19 13:03:04 +02:00
|
|
|
export class LoginUriExport {
|
|
|
|
static template(): LoginUriExport {
|
|
|
|
const req = new LoginUriExport();
|
2018-12-17 16:29:37 +01:00
|
|
|
req.uri = "https://google.com";
|
|
|
|
req.match = null;
|
|
|
|
return req;
|
2021-12-16 13:36:21 +01:00
|
|
|
}
|
|
|
|
|
2022-04-19 13:03:04 +02:00
|
|
|
static toView(req: LoginUriExport, view = new LoginUriView()) {
|
2018-12-17 16:29:37 +01:00
|
|
|
view.uri = req.uri;
|
|
|
|
view.match = req.match;
|
|
|
|
return view;
|
2021-12-16 13:36:21 +01:00
|
|
|
}
|
|
|
|
|
2022-04-19 13:03:04 +02:00
|
|
|
static toDomain(req: LoginUriExport, domain = new LoginUriDomain()) {
|
2021-04-21 02:16:19 +02:00
|
|
|
domain.uri = req.uri != null ? new EncString(req.uri) : null;
|
2020-12-05 03:05:11 +01:00
|
|
|
domain.match = req.match;
|
|
|
|
return domain;
|
2021-12-16 13:36:21 +01:00
|
|
|
}
|
|
|
|
|
2018-12-17 16:29:37 +01:00
|
|
|
uri: string;
|
|
|
|
match: UriMatchType = null;
|
2021-12-16 13:36:21 +01:00
|
|
|
|
2020-12-03 21:20:38 +01:00
|
|
|
constructor(o?: LoginUriView | LoginUriDomain) {
|
2018-12-17 16:29:37 +01:00
|
|
|
if (o == null) {
|
2021-12-16 13:36:21 +01:00
|
|
|
return;
|
2018-12-17 16:29:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (o instanceof LoginUriView) {
|
|
|
|
this.uri = o.uri;
|
2020-12-03 21:20:38 +01:00
|
|
|
} else {
|
|
|
|
this.uri = o.uri?.encryptedString;
|
2018-12-17 16:29:37 +01:00
|
|
|
}
|
|
|
|
this.match = o.match;
|
2021-12-16 13:36:21 +01:00
|
|
|
}
|
2018-12-17 16:29:37 +01:00
|
|
|
}
|