Merge branch 'seed-europe'
# Conflicts: # README.md
This commit is contained in:
commit
3aee48997c
19 files changed
+3362
-1394
No files matched your search
+13
-1
@@ -91,6 +91,10 @@ CREATE TABLE IF NOT EXISTS role_tags (
|
||||
|
||||
-- A company as a target, whether or not any board of it is read. key is
|
||||
-- models.company_key(name), the slug roles.company_key holds.
|
||||
-- ats is the host the careers site runs on, readable by the ats plugin or
|
||||
-- not (workday, successfactors, ...): what discovery found, '' unknown. A
|
||||
-- company with an ats and no board subscription is one the app cannot read
|
||||
-- yet. country is an ISO code and city the head office's.
|
||||
CREATE TABLE IF NOT EXISTS companies (
|
||||
key TEXT PRIMARY KEY,
|
||||
name TEXT NOT NULL,
|
||||
@@ -99,7 +103,10 @@ CREATE TABLE IF NOT EXISTS companies (
|
||||
careers_url TEXT NOT NULL DEFAULT '',
|
||||
notes TEXT NOT NULL DEFAULT '',
|
||||
created_at TEXT NOT NULL,
|
||||
updated_at TEXT NOT NULL
|
||||
updated_at TEXT NOT NULL,
|
||||
ats TEXT NOT NULL DEFAULT '',
|
||||
country TEXT NOT NULL DEFAULT '',
|
||||
city TEXT NOT NULL DEFAULT ''
|
||||
);
|
||||
|
||||
-- The targets desk's runner hands to plugins. newsdesk's shape, with its two
|
||||
@@ -319,6 +326,11 @@ SELECT (SELECT id FROM agents ORDER BY enabled DESC, id LIMIT 1), key, affinity,
|
||||
ALTER TABLE roles DROP COLUMN vote;
|
||||
ALTER TABLE roles DROP COLUMN voted_at;
|
||||
ALTER TABLE companies DROP COLUMN affinity;
|
||||
"""),
|
||||
(7, "companies.ats, country and city: a company the app cannot read yet is still a row", """
|
||||
ALTER TABLE companies ADD COLUMN ats TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE companies ADD COLUMN country TEXT NOT NULL DEFAULT '';
|
||||
ALTER TABLE companies ADD COLUMN city TEXT NOT NULL DEFAULT '';
|
||||
"""),
|
||||
)
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ _VOTED_SCORE = ("MIN(1.0, s.score * CASE v.vote WHEN -1 THEN 0.5 "
|
||||
#: nothing, so `vote` and `voted_at` are NULL: one query shape either way.
|
||||
_WITH_VOTES = "LEFT JOIN role_votes v ON v.uid = roles.uid AND v.agent_id = ?"
|
||||
|
||||
_COMPANY_FIELDS = ("name", "domain", "status", "careers_url", "notes")
|
||||
_COMPANY_FIELDS = ("name", "domain", "status", "careers_url", "notes", "ats", "country", "city")
|
||||
|
||||
#: A company as the store serves it: the row and the asked-for agent's affinity.
|
||||
_COMPANY_SELECT = """SELECT c.*, COALESCE(ac.affinity, 0) AS affinity FROM companies c
|
||||
@@ -967,7 +967,8 @@ class Store:
|
||||
|
||||
def add_company(self, name: str, *, key: str = "", domain: str = "",
|
||||
status: str = "researching", careers_url: str = "",
|
||||
notes: str = "") -> Company:
|
||||
notes: str = "", ats: str = "", country: str = "",
|
||||
city: str = "") -> Company:
|
||||
"""Raises ValueError on a key already taken."""
|
||||
name = name.strip()
|
||||
key = key or company_key(name)
|
||||
@@ -977,9 +978,10 @@ class Store:
|
||||
try:
|
||||
self._write(
|
||||
"""INSERT INTO companies (key, name, domain, status, careers_url, notes,
|
||||
created_at, updated_at)
|
||||
VALUES (?,?,?,?,?,?,?,?)""",
|
||||
(key, name, domain, status, careers_url, notes, stamp, stamp))
|
||||
ats, country, city, created_at, updated_at)
|
||||
VALUES (?,?,?,?,?,?,?,?,?,?,?)""",
|
||||
(key, name, domain, status, careers_url, notes, ats, country, city,
|
||||
stamp, stamp))
|
||||
except sqlite3.IntegrityError as exc:
|
||||
raise ValueError(f"company {key!r} already exists") from exc
|
||||
return self._company(key)
|
||||
|
||||
Reference in new issue
Block a user