Adapters.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. import format from 'date-fns/format';
  17. import { BaseEntity } from './BaseEntity';
  18. export class Adapters extends BaseEntity {
  19. name!: String;
  20. protocol!: String;
  21. adapter!: String;
  22. switch_dynamic: boolean = false;
  23. constructor() {
  24. super();
  25. }
  26. override init(data: any): void {
  27. Object.assign(this, data);
  28. if (this.status == 1) {
  29. this.switch_status = true;
  30. }
  31. }
  32. override trans(): void {
  33. if (this.switch_status) {
  34. this.status = 1;
  35. } else {
  36. this.status = 0;
  37. }
  38. }
  39. }