~sircmpwn/names.sr.ht

ref: 7d85145ed46ad9647cb8abd17b9d32717ec4644a names.sr.ht/names/types/__init__.py -rw-r--r-- 2.1 KiB
7d85145eDrew DeVault Refine database schema throughout 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
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
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')

    default_owner_id = sa.Column(sa.Integer, sa.ForeignKey("domain_contact.id"))
    default_owner = sa.orm.relationship("DomainContact",
            foreign_keys=[default_owner_id])

    default_admin_id = sa.Column(sa.Integer, sa.ForeignKey("domain_contact.id"))
    default_admin = sa.orm.relationship("DomainContact",
            foreign_keys=[default_admin_id])

    default_billing_id = sa.Column(sa.Integer,
            sa.ForeignKey("domain_contact.id"))
    default_billing = sa.orm.relationship("DomainContact",
            foreign_keys=[default_billing_id])

    default_tech_id = sa.Column(sa.Integer, sa.ForeignKey("domain_contact.id"))
    default_tech = sa.orm.relationship("DomainContact",
            foreign_keys=[default_tech_id])