def unique(): data = request.json contract = data['contract'] ooi_contracts = data['ooi_contracts'] e = EtherscanService() addresses = e.unique_users(contract, ooi_contracts) return AddressSerializer.render_json(addresses)
class PersonFullPostSerializer(HashPkSerializerBase): addresses = AddressSerializer(many=True, allow_add_remove=True) phones = PhoneSerializer(many=True, allow_add_remove=True) emergency_contact = EmergencyContactSerializer(many=True, allow_add_remove=True) class Meta: model = Person fields = ('id', 'person_type', 'reason_for_change', 'relationship', 'first_name', 'last_name', 'middle_name', 'ssn', 'email', 'birth_date', 'phones', 'addresses', 'company', 'user', 'emergency_contact', 'gender')
class CompanyPostSerializer(HashPkSerializerBase): addresses = AddressSerializer(many=True, allow_add_remove=True) contacts = PersonPostSerializer(many=True, allow_add_remove=True) class Meta: model = Company fields = ('id', 'name', 'pay_period_definition', 'contacts', 'addresses', 'ein')
class PersonSerializer(HashPkSerializerBase): addresses = AddressSerializer(many=True) phones = PhoneSerializer(many=True) emergency_contact = EmergencyContactSerializer(many=True) company = HashField(source="company.id") user = HashField(source="user.id") class Meta: model = Person fields = ('id', 'person_type', 'reason_for_change', 'relationship', 'first_name', 'last_name', 'middle_name', 'email', 'birth_date', 'phones', 'addresses', 'company', 'user', 'emergency_contact', 'gender')
class CompanySerializer(HashPkSerializerBase): addresses = AddressSerializer(many=True) contacts = PersonSerializer(many=True) pay_period_definition = SysPeriodDefinitionSerializer() class Meta: model = Company fields = ('id', 'name', 'pay_period_definition', 'contacts', 'addresses', 'ein')
def in_common(contracts): li_contracts = list(contracts.split(',')) e = EtherscanService() addresses_in_common = e.addresses_in_common(li_contracts) return AddressSerializer.render_json(addresses_in_common)
def addresses(contract): e = EtherscanService() addresses = e.addresses_by_contract(contract) return AddressSerializer.render_json(addresses)