Build tree couples
This commit is contained in:
		@@ -1,5 +1,6 @@
 | 
			
		||||
import { APIClient } from "./ApiClient";
 | 
			
		||||
import { DateValue, Member } from "./MemberApi";
 | 
			
		||||
import { ServerApi } from "./ServerApi";
 | 
			
		||||
 | 
			
		||||
interface CoupleApiInterface {
 | 
			
		||||
  id: number;
 | 
			
		||||
@@ -99,6 +100,10 @@ export class Couple implements CoupleApiInterface {
 | 
			
		||||
      day: this.divorce_day,
 | 
			
		||||
    };
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  otherPersonID(id: number): number | undefined {
 | 
			
		||||
    return id === this.wife ? this.husband : this.wife;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export class CouplesList {
 | 
			
		||||
@@ -137,6 +142,10 @@ export class CouplesList {
 | 
			
		||||
  getAllOf(m: Member): Couple[] {
 | 
			
		||||
    return this.filter((c) => c.husband === m.id || c.wife === m.id);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  getFirstMariedOf(m: Member): Couple | undefined {
 | 
			
		||||
    return this.getAllOf(m).find((c) => (c.state = "M"));
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export class CoupleApi {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user