~sircmpwn/names.sr.ht

ref: 4befa4e5942b52045dc9ef9bcd3473389db71d61 names.sr.ht/names/types/__init__.py -rw-r--r-- 2.3 KiB
4befa4e5Drew DeVault Add tables for remaining TLDs with special reqs 1 year, 10 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import sqlalchemy as sa
from enum import IntFlag, auto
from srht.database import Base
from srht.flagtype import FlagType
from srht.oauth import ExternalUserMixin
from names.types.contact import DomainContact, ContactType
from names.types.gtld_specific import *

class ExtendedDomainData(IntFlag):
    """
    Various gTLDs require us to collect extra information. This flag tells
    us what we've already collected for each such gTLD.
    """
    # Do not modify the sort order of this list! It is append-only.
    abogado = auto()
    aero = auto()
    au = auto()
    cl = auto()
    co_hu = auto()
    co_za = auto()
    com_ar = auto()
    com_br = auto()
    com_lv = auto()
    com_mx = auto()
    com_pt = auto()
    com_ro = auto()
    coop = auto()
    de = auto()
    dk = auto()
    es = auto()
    eu = auto()
    fi = auto()
    fr = auto()
    hk = auto()
    hu = auto()
    it = auto()
    jobs = auto()
    law = auto()
    lv = auto()
    mx = auto()
    my = auto()
    no = auto()
    nu = auto()
    nyc = auto()
    pm = auto()
    pro = auto()
    pt = auto()
    re = auto()
    ro = auto()
    ru = auto()
    se = auto()
    sg = auto()
    tf = auto()
    travel = auto()
    uk = auto()
    us = auto()
    wf = auto()
    xxx = auto()
    yt = auto()

class User(Base, ExternalUserMixin):
    extra_info = sa.Column(FlagType(ExtendedDomainData),
            nullable=False, server_default='0')

    owner_contact = sa.orm.relationship("DomainContact",
            primaryjoin=sa.and_(
                ExternalUserMixin.id == DomainContact.user_id,
                DomainContact._contact_type == ContactType.owner.value))

    admin_contact = sa.orm.relationship("DomainContact",
            primaryjoin=sa.and_(
                ExternalUserMixin.id == DomainContact.user_id,
                DomainContact._contact_type == ContactType.admin.value))

    billing_contact = sa.orm.relationship("DomainContact",
            primaryjoin=sa.and_(
                ExternalUserMixin.id == DomainContact.user_id,
                DomainContact._contact_type == ContactType.billing.value))

    tech_contact = sa.orm.relationship("DomainContact",
            primaryjoin=sa.and_(
                ExternalUserMixin.id == DomainContact.user_id,
                DomainContact._contact_type == ContactType.tech.value))