2020-06-23 11:44:14 +00:00
|
|
|
/*
|
|
|
|
|
|
|
|
Copyright (c) 2018 - 2020 Michael Mayer <hello@photoprism.org>
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU Affero General Public License as published
|
|
|
|
by the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
2020-06-23 11:53:11 +00:00
|
|
|
PhotoPrism™ is a registered trademark of Michael Mayer. You may use it as required
|
|
|
|
to describe our software, run your own server, for educational purposes, but not for
|
|
|
|
offering commercial goods, products, or services without prior written permission.
|
|
|
|
In other words, please ask.
|
2020-06-23 11:44:14 +00:00
|
|
|
|
|
|
|
Feel free to send an e-mail to hello@photoprism.org if you have questions,
|
|
|
|
want to support our work, or just want to say hello.
|
|
|
|
|
|
|
|
Additional information can be found in our Developer Guide:
|
|
|
|
https://docs.photoprism.org/developer-guide/
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2020-04-14 11:13:45 +00:00
|
|
|
import RestModel from "model/rest";
|
2020-03-29 19:24:44 +00:00
|
|
|
import Api from "../common/api";
|
2020-03-28 17:17:11 +00:00
|
|
|
|
2020-05-22 14:29:12 +00:00
|
|
|
export class Account extends RestModel {
|
2020-03-28 17:17:11 +00:00
|
|
|
getDefaults() {
|
|
|
|
return {
|
|
|
|
ID: 0,
|
|
|
|
AccName: "",
|
|
|
|
AccOwner: "",
|
|
|
|
AccURL: "",
|
|
|
|
AccType: "",
|
|
|
|
AccKey: "",
|
|
|
|
AccUser: "",
|
|
|
|
AccPass: "",
|
|
|
|
AccError: "",
|
2020-04-04 15:19:34 +00:00
|
|
|
AccErrors: 0,
|
2020-03-29 19:24:44 +00:00
|
|
|
AccShare: true,
|
2020-03-28 17:17:11 +00:00
|
|
|
AccSync: false,
|
|
|
|
RetryLimit: 3,
|
2020-03-29 19:24:44 +00:00
|
|
|
SharePath: "/",
|
2020-04-03 16:08:49 +00:00
|
|
|
ShareSize: "",
|
2020-06-27 11:08:45 +00:00
|
|
|
Expires: 0,
|
2020-03-29 19:24:44 +00:00
|
|
|
SyncPath: "/",
|
2020-04-04 15:19:34 +00:00
|
|
|
SyncStatus: "",
|
2020-03-28 17:17:11 +00:00
|
|
|
SyncInterval: 86400,
|
2020-04-04 15:19:34 +00:00
|
|
|
SyncDate: null,
|
2020-04-07 08:42:42 +00:00
|
|
|
SyncFilenames: true,
|
2020-03-28 17:17:11 +00:00
|
|
|
SyncUpload: false,
|
|
|
|
SyncDownload: true,
|
|
|
|
SyncRaw: true,
|
|
|
|
CreatedAt: "",
|
|
|
|
UpdatedAt: "",
|
|
|
|
DeletedAt: null,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
getEntityName() {
|
|
|
|
return this.AccName;
|
|
|
|
}
|
|
|
|
|
|
|
|
getId() {
|
|
|
|
return this.ID;
|
|
|
|
}
|
|
|
|
|
2020-04-02 16:17:07 +00:00
|
|
|
Dirs() {
|
|
|
|
return Api.get(this.getEntityResource() + "/dirs").then((response) => Promise.resolve(response.data));
|
2020-03-31 15:26:25 +00:00
|
|
|
}
|
|
|
|
|
2020-05-23 18:58:58 +00:00
|
|
|
Share(photos, dest) {
|
|
|
|
const values = {Photos: photos, Destination: dest};
|
2020-04-01 10:00:45 +00:00
|
|
|
|
|
|
|
return Api.post(this.getEntityResource() + "/share", values).then((response) => Promise.resolve(response.data));
|
|
|
|
}
|
|
|
|
|
2020-03-28 17:17:11 +00:00
|
|
|
static getCollectionResource() {
|
|
|
|
return "accounts";
|
|
|
|
}
|
|
|
|
|
|
|
|
static getModelName() {
|
|
|
|
return "Account";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Account;
|