@tamu-dor/famis-db 2.0.2 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/.github/workflows/actions.yml +16 -0
  2. package/docs/index.html +1453 -335
  3. package/docs.md +363 -190
  4. package/index.d.ts +619 -0
  5. package/index.js +56 -2
  6. package/package.json +3 -3
  7. package/readme.md +2 -2
  8. package/schemas/migrations/202102041628.sql +26 -0
  9. package/schemas/migrations/202102261131.sql +68 -0
  10. package/schemas/migrations/202104011516.sql +12 -0
  11. package/schemas/migrations/202104210829.sql +69 -0
  12. package/schemas/migrations/202104210926.sql +77 -0
  13. package/schemas/migrations/202105201344.sql +17 -0
  14. package/schemas/migrations/202105201355.sql +26 -0
  15. package/schemas/migrations/202105251323.sql +17 -0
  16. package/schemas/migrations/202106081436.sql +20 -0
  17. package/schemas/migrations/202106221333.sql +20 -0
  18. package/schemas/migrations/202107291406.sql +35 -0
  19. package/schemas/migrations/202108181427.sql +26 -0
  20. package/schemas/migrations/202110041133.sql +75 -0
  21. package/schemas/migrations/202110251113.sql +20 -0
  22. package/schemas/migrations/202111021104.sql +13 -0
  23. package/schemas/migrations/202111021110.sql +16 -0
  24. package/schemas/migrations/202111100901.sql +16 -0
  25. package/schemas/migrations/202111101041.sql +79 -0
  26. package/schemas/migrations/20211115.sql +71 -0
  27. package/schemas/migrations/202112171038.sql +89 -0
  28. package/schemas/migrations/202201211055.sql +97 -0
  29. package/schemas/migrations/202201211124.sql +24 -0
  30. package/schemas/migrations/202201261015.sql +17 -0
  31. package/schemas/migrations/202201311403.sql +91 -0
  32. package/schemas/migrations/202202081201.sql +41 -0
  33. package/schemas/migrations/202202081205.sql +45 -0
  34. package/schemas/migrations/202202141101.sql +21 -0
  35. package/schemas/migrations/202202141117.sql +76 -0
  36. package/schemas/migrations/202202151329.sql +21 -0
  37. package/schemas/migrations/202202171025.sql +4 -0
  38. package/schemas/migrations/20220225.sql +23 -0
  39. package/schemas/migrations/202203150618.sql +13 -0
  40. package/schemas/migrations/202204041316.sql +12 -0
  41. package/schemas/migrations/202204141018.sql +78 -0
  42. package/schemas/migrations/202204141301.sql +36 -0
  43. package/schemas/migrations/202205061236.sql +15 -0
  44. package/schemas/migrations/202206021248.sql +20 -0
  45. package/schemas/migrations/20220615.sql +39 -0
  46. package/schemas/migrations/202206291132.sql +15 -0
  47. package/schemas/migrations/202207290901.sql +31 -0
  48. package/schemas/migrations/202207290907.sql +26 -0
  49. package/schemas/migrations/202208241422.sql +21 -0
  50. package/schemas/migrations/202209141529.sql +21 -0
  51. package/schemas/migrations/202209300911.sql +35 -0
  52. package/schemas/migrations/202210111429.sql +35 -0
  53. package/schemas/migrations/202210111456.sql +57 -0
  54. package/schemas/migrations/202210171517.sql +23 -0
  55. package/schemas/migrations/202211091403.sql +26 -0
  56. package/schemas/migrations/202211091410.sql +26 -0
  57. package/schemas/migrations/202211091417.sql +31 -0
  58. package/schemas/migrations/202211161451.sql +81 -0
  59. package/schemas/migrations/202212141236.sql +37 -0
  60. package/schemas/migrations/202302201117.sql +73 -0
  61. package/schemas/migrations/202303081110.sql +78 -0
  62. package/schemas/migrations/202304191238.sql +12 -0
  63. package/schemas/migrations/202304271214.sql +7 -0
  64. package/schemas/schema.sql +57 -22
  65. package/change.txt +0 -123
  66. package/changes.md +0 -405
  67. package/famisDb.pdf +0 -0
  68. package/readme.wiki +0 -332
@@ -0,0 +1,26 @@
1
+ -- Update Image Analysis Laboratory contact information:
2
+ -- Add Clements, Kaylyn A
3
+ BEGIN TRANSACTION;
4
+ DO $$
5
+ DECLARE
6
+ core_id integer;
7
+ user_id integer;
8
+ core_name CONSTANT varchar := 'Image Analysis Laboratory';
9
+ user1 CONSTANT varchar := '76740038c87eb04d4be79b0f2cd34888';
10
+ BEGIN
11
+ IF NOT EXISTS (
12
+ SELECT 1 FROM public.cores WHERE facility = core_name
13
+ ) THEN
14
+ RAISE NOTICE 'Core does not exist.';
15
+ ELSE
16
+ SELECT id INTO STRICT core_id FROM public.cores WHERE facility = core_name;
17
+ -- there are unique constraints on users.userId and user_cores.(coreId + userId)
18
+ INSERT INTO public.users ("userId") VALUES (user1)
19
+ ON CONFLICT ("userId") DO UPDATE SET deleted = null;
20
+ SELECT id INTO STRICT user_id FROM public.users
21
+ WHERE "userId" = user1;
22
+ INSERT INTO public.user_cores ("coreId", "userId", email) VALUES (core_id, user_id, TRUE)
23
+ ON CONFLICT DO NOTHING;
24
+ END IF;
25
+ END $$ ;
26
+ COMMIT;
@@ -0,0 +1,31 @@
1
+ -- Update TEES Financial user information:
2
+ -- Add TEES iLab Email as a role account and provision for system part
3
+ BEGIN TRANSACTION;
4
+ DO $$
5
+ DECLARE
6
+ system_id integer;
7
+ user_id integer;
8
+ part_num CONSTANT varchar := '28';
9
+ -- user1 is a role email account. The UID has been generated and is not from
10
+ -- TAMU directory services.
11
+ user1 CONSTANT varchar := '8561e8c0606b11ed834b5726c991c562';
12
+ role_name CONSTANT varchar := 'TEES iLab Email';
13
+ role_email CONSTANT varchar := 'teesilab@tamu.edu';
14
+ BEGIN
15
+ IF NOT EXISTS (
16
+ SELECT 1 FROM public.system WHERE "part" = part_num
17
+ ) THEN
18
+ RAISE NOTICE 'System part does not exist.';
19
+ ELSE
20
+ SELECT id INTO STRICT system_id FROM public.system WHERE "part" = part_num;
21
+
22
+ INSERT INTO public.users ("userId", "role", "roleName", "roleEmail")
23
+ VALUES (user1, TRUE, role_name, role_email)
24
+ ON CONFLICT DO NOTHING;
25
+ SELECT id INTO STRICT user_id FROM public.users
26
+ WHERE "userId" = user1;
27
+ INSERT INTO public.user_systems ("systemId", "userId", email) VALUES (system_id, user_id, TRUE)
28
+ ON CONFLICT DO NOTHING;
29
+ END IF;
30
+ END $$ ;
31
+ COMMIT;
@@ -0,0 +1,81 @@
1
+ -- Onboard Rapid Prototyping Studio, which has already billed on 2022-11-14.
2
+
3
+ -- Add Bienski, Natalie M as a user and billing manager for core
4
+ -- Add Galetka, Nicholas Anton Owen as a billing manager for core
5
+
6
+ BEGIN TRANSACTION;
7
+ DO $$
8
+ DECLARE
9
+ core_id integer;
10
+ user_id integer;
11
+ system_id integer;
12
+ core_name CONSTANT varchar := 'Rapid Prototyping Studio';
13
+ core_contact CONSTANT varchar := 'Natalie Bienski';
14
+ core_contact_email CONSTANT varchar := 'nbienski@tamu.edu';
15
+ core_email CONSTANT varchar := 'meen3Dprinting@tamu.edu';
16
+ core_address CONSTANT varchar := '3123 TAMU
17
+ College Station, TX 77843';
18
+ core_phone CONSTANT varchar := NULL;
19
+ revenue_account CONSTANT varchar := '0227067000000';
20
+ part_number CONSTANT varchar := '02';
21
+ user1 CONSTANT varchar := 'c1d12a955385ec6ebd7a1a81c4b95114';
22
+ user2 CONSTANT varchar := '7324ccb811bdcd2037a2c65989a4371a';
23
+ BEGIN
24
+ SELECT id INTO STRICT system_id FROM public.system WHERE part = part_number;
25
+ IF NOT EXISTS (
26
+ SELECT 1 FROM public.cores WHERE facility = core_name
27
+ ) THEN
28
+ INSERT INTO public.cores (facility, contact, "contactEmail",
29
+ "systemId", enabled, "coreEmail", "corePhone", "coreAddress")
30
+ VALUES (
31
+ core_name,
32
+ core_contact,
33
+ core_contact_email,
34
+ system_id,
35
+ TRUE,
36
+ core_email,
37
+ core_phone,
38
+ core_address
39
+ );
40
+ ELSE
41
+ UPDATE public.cores SET
42
+ contact = core_contact,
43
+ "contactEmail" = core_contact_email,
44
+ "systemId" = system_id,
45
+ enabled = TRUE,
46
+ "coreEmail" = core_email,
47
+ "corePhone" = core_phone,
48
+ "coreAddress" = core_address
49
+ WHERE facility = core_name;
50
+ END IF;
51
+ -- assign id to variable; STRICT requires exactly one row be found
52
+ SELECT id INTO STRICT core_id FROM public.cores WHERE facility = core_name;
53
+
54
+ IF NOT EXISTS (
55
+ SELECT 1 FROM public.core_accounts WHERE "coreId" = core_id
56
+ ) THEN
57
+ INSERT INTO public.core_accounts ("coreId", account, effective)
58
+ VALUES (core_id, revenue_account, '2022-11-14');
59
+ ELSE
60
+ UPDATE public.core_accounts SET account = revenue_account, effective = '2022-11-14'
61
+ WHERE "coreId" = core_id AND effective = (SELECT MAX(effective)
62
+ FROM public.core_accounts WHERE "coreId" = core_id);
63
+ END IF;
64
+
65
+ -- there are unique constraints on users.userId and user_cores.(coreId + userId)
66
+ INSERT INTO public.users ("userId") VALUES (user1)
67
+ ON CONFLICT DO NOTHING;
68
+ SELECT id INTO STRICT user_id FROM public.users
69
+ WHERE "userId" = user1;
70
+ INSERT INTO public.user_cores ("coreId", "userId", email) VALUES (core_id, user_id, TRUE)
71
+ ON CONFLICT DO NOTHING;
72
+
73
+ INSERT INTO public.users ("userId") VALUES (user2)
74
+ ON CONFLICT DO NOTHING;
75
+ SELECT id INTO STRICT user_id FROM public.users
76
+ WHERE "userId" = user2;
77
+ INSERT INTO public.user_cores ("coreId", "userId", email) VALUES (core_id, user_id, TRUE)
78
+ ON CONFLICT DO NOTHING;
79
+
80
+ END $$ ;
81
+ COMMIT;
@@ -0,0 +1,37 @@
1
+ -- Update COM Cell Analysis Facility user information:
2
+ -- Add COM Cell Analysis Facility Email as a role account and provision for core
3
+ -- Remove Reyes, Sandra A
4
+ BEGIN TRANSACTION;
5
+ DO $$
6
+ DECLARE
7
+ core_id integer;
8
+ user_id integer;
9
+ core_name CONSTANT varchar := 'COM Cell Analysis Facility (COM-CAF)';
10
+ -- user1 is a role email account. The UID has been generated and is not from
11
+ -- TAMU directory services.
12
+ user1 CONSTANT varchar := '69b2a1a87bde11ed8de973f2a5c7ddcd';
13
+ role_name CONSTANT varchar := 'COM Cell Analysis Facility (COM-CAF) Email';
14
+ role_email CONSTANT varchar := 'mpimbusiness@tamu.edu';
15
+ user2 CONSTANT varchar := 'a81e9e443aca9870daa1aeb8ca399167';
16
+ BEGIN
17
+ IF NOT EXISTS (
18
+ SELECT 1 FROM public.cores WHERE facility = core_name
19
+ ) THEN
20
+ RAISE NOTICE 'Core does not exist.';
21
+ ELSE
22
+ SELECT id INTO STRICT core_id FROM public.cores WHERE facility = core_name;
23
+
24
+ INSERT INTO public.users ("userId", "role", "roleName", "roleEmail")
25
+ VALUES (user1, TRUE, role_name, role_email)
26
+ ON CONFLICT DO NOTHING;
27
+ SELECT id INTO STRICT user_id FROM public.users
28
+ WHERE "userId" = user1;
29
+ INSERT INTO public.user_cores("coreId", "userId", email) VALUES (core_id, user_id, TRUE)
30
+ ON CONFLICT DO NOTHING;
31
+ -- Delete user from core
32
+ SELECT id INTO STRICT user_id FROM public.users WHERE "userId" = user2;
33
+ DELETE FROM public.user_cores WHERE "userId" = user_id AND "coreId" = core_id;
34
+ UPDATE public.users set deleted = NOW() WHERE "userId" = user2;
35
+ END IF;
36
+ END $$ ;
37
+ COMMIT;
@@ -0,0 +1,73 @@
1
+ -- Add VMBS Core Histology Lab
2
+ -- Add Reismeier, Lori A and provision for core
3
+ BEGIN;
4
+ DO $$
5
+ DECLARE
6
+ core_id integer;
7
+ user_id integer;
8
+ system_id integer;
9
+ core_name CONSTANT varchar := 'VMBS Core Histology Lab';
10
+ core_contact CONSTANT varchar := 'Lori Reismeier';
11
+ core_contact_email CONSTANT varchar := 'lreismeier@tamu.edu';
12
+ core_email CONSTANT varchar := NULL;
13
+ core_address CONSTANT varchar := 'VMBS Histology Research Lab
14
+ 664 Raymond Stotzer Parkway | 4467 TAMU
15
+ College Station, TX
16
+ 77843-4467';
17
+ core_phone CONSTANT varchar := NULL;
18
+ revenue_account CONSTANT varchar := '0227167000000';
19
+ part_number CONSTANT varchar := '02';
20
+ user1 CONSTANT varchar := 'f8c468ebec93a4c4b709e62210c08dee';
21
+ effective_date date := '2023-01-01';
22
+ BEGIN
23
+ SELECT id INTO STRICT system_id FROM public.system WHERE part = part_number;
24
+ IF NOT EXISTS (
25
+ SELECT 1 FROM public.cores WHERE facility = core_name
26
+ ) THEN
27
+ INSERT INTO public.cores (facility, contact, "contactEmail",
28
+ "systemId", enabled, "coreEmail", "corePhone", "coreAddress")
29
+ VALUES (
30
+ core_name,
31
+ core_contact,
32
+ core_contact_email,
33
+ system_id,
34
+ TRUE,
35
+ core_email,
36
+ core_phone,
37
+ core_address
38
+ );
39
+ ELSE
40
+ UPDATE public.cores SET
41
+ contact = core_contact,
42
+ "contactEmail" = core_contact_email,
43
+ "systemId" = system_id,
44
+ enabled = TRUE,
45
+ "coreEmail" = core_email,
46
+ "corePhone" = core_phone,
47
+ "coreAddress" = core_address
48
+ WHERE facility = core_name;
49
+ END IF;
50
+ -- assign id to variable; STRICT requires exactly one row be found
51
+ SELECT id INTO STRICT core_id FROM public.cores WHERE facility = core_name;
52
+
53
+ IF NOT EXISTS (
54
+ SELECT 1 FROM public.core_accounts WHERE "coreId" = core_id
55
+ ) THEN
56
+ INSERT INTO public.core_accounts ("coreId", account, effective)
57
+ VALUES (core_id, revenue_account, effective_date);
58
+ ELSE
59
+ UPDATE public.core_accounts SET account = revenue_account, effective = effective_date
60
+ WHERE "coreId" = core_id AND effective = (SELECT MAX(effective)
61
+ FROM public.core_accounts WHERE "coreId" = core_id);
62
+ END IF;
63
+
64
+ -- there are unique constraints on users.userId and user_cores.(coreId + userId)
65
+ INSERT INTO public.users ("userId") VALUES (user1)
66
+ ON CONFLICT DO NOTHING;
67
+ SELECT id INTO STRICT user_id FROM public.users
68
+ WHERE "userId" = user1;
69
+ INSERT INTO public.user_cores ("coreId", "userId", email) VALUES (core_id, user_id, TRUE)
70
+ ON CONFLICT DO NOTHING;
71
+
72
+ END $$ ;
73
+ COMMIT;
@@ -0,0 +1,78 @@
1
+ -- Add IBT Flow Cytometry Analysis and Cell Sorting Core
2
+ -- Add Isgandarova, Sevinj and provision for core
3
+ -- Provision DuBose, Candida for core
4
+ BEGIN;
5
+ DO $$
6
+ DECLARE
7
+ core_id integer;
8
+ user_id integer;
9
+ system_id integer;
10
+ core_name CONSTANT varchar := 'IBT Flow Cytometry Analysis and Cell Sorting Core';
11
+ core_contact CONSTANT varchar := 'Candida DuBose';
12
+ core_contact_email CONSTANT varchar := 'cdubose@tamu.edu';
13
+ core_email CONSTANT varchar := NULL;
14
+ core_address CONSTANT varchar := NULL;
15
+ core_phone CONSTANT varchar := '713-677-8118';
16
+ revenue_account CONSTANT varchar := '2328020000000';
17
+ part_number CONSTANT varchar := '23';
18
+ user1 CONSTANT varchar := 'c919d0c69fc73efd72450f7bddfcde29';
19
+ user2 CONSTANT varchar := '1bd645107a1b040cd187591af43a2680';
20
+ effective_date date := '2023-01-01';
21
+ BEGIN
22
+ SELECT id INTO STRICT system_id FROM public.system WHERE part = part_number;
23
+ IF NOT EXISTS (
24
+ SELECT 1 FROM public.cores WHERE facility = core_name
25
+ ) THEN
26
+ INSERT INTO public.cores (facility, contact, "contactEmail",
27
+ "systemId", enabled, "coreEmail", "corePhone", "coreAddress")
28
+ VALUES (
29
+ core_name,
30
+ core_contact,
31
+ core_contact_email,
32
+ system_id,
33
+ TRUE,
34
+ core_email,
35
+ core_phone,
36
+ core_address
37
+ );
38
+ ELSE
39
+ UPDATE public.cores SET
40
+ contact = core_contact,
41
+ "contactEmail" = core_contact_email,
42
+ "systemId" = system_id,
43
+ enabled = TRUE,
44
+ "coreEmail" = core_email,
45
+ "corePhone" = core_phone,
46
+ "coreAddress" = core_address
47
+ WHERE facility = core_name;
48
+ END IF;
49
+ -- assign id to variable; STRICT requires exactly one row be found
50
+ SELECT id INTO STRICT core_id FROM public.cores WHERE facility = core_name;
51
+
52
+ IF NOT EXISTS (
53
+ SELECT 1 FROM public.core_accounts WHERE "coreId" = core_id
54
+ ) THEN
55
+ INSERT INTO public.core_accounts ("coreId", account, effective)
56
+ VALUES (core_id, revenue_account, effective_date);
57
+ ELSE
58
+ UPDATE public.core_accounts SET account = revenue_account, effective = effective_date
59
+ WHERE "coreId" = core_id AND effective = (SELECT MAX(effective)
60
+ FROM public.core_accounts WHERE "coreId" = core_id);
61
+ END IF;
62
+
63
+ -- there are unique constraints on users.userId and user_cores.(coreId + userId)
64
+ INSERT INTO public.users ("userId") VALUES (user1)
65
+ ON CONFLICT DO NOTHING;
66
+ SELECT id INTO STRICT user_id FROM public.users
67
+ WHERE "userId" = user1;
68
+ INSERT INTO public.user_cores ("coreId", "userId", email) VALUES (core_id, user_id, TRUE)
69
+ ON CONFLICT DO NOTHING;
70
+
71
+ -- user2 already exists; only insert permissions for user on core
72
+ SELECT id INTO STRICT user_id FROM public.users
73
+ WHERE "userId" = user2;
74
+ INSERT INTO public.user_cores ("coreId", "userId", email) VALUES (core_id, user_id, TRUE)
75
+ ON CONFLICT DO NOTHING;
76
+
77
+ END $$ ;
78
+ COMMIT;
@@ -0,0 +1,12 @@
1
+ -- Reset invoices SMF-3625372 and SMF-3625348 to use different object code
2
+ -- TEES does not accept 0496
3
+ -- Courtney Cammack offered 0574 as an alternative
4
+ BEGIN TRANSACTION;
5
+ UPDATE invoices SET
6
+ data = replace(data::text, '"sellingObjectCode": "0496"', '"sellingObjectCode": "0574"')::jsonb,
7
+ "postedDate" = NULL,
8
+ invoiced = False
9
+ WHERE
10
+ "number" = 'SMF-3625372'
11
+ OR "number" = 'SMF-3625348';
12
+ COMMIT TRANSACTION;
@@ -0,0 +1,7 @@
1
+ -- Add 0574 revenue code per Courtney Cammack
2
+ BEGIN TRANSACTION;
3
+ INSERT INTO codes (revenue, expense, sales, srs) VALUES ('0574', '5670', FALSE, TRUE);
4
+ COMMENT ON COLUMN public.codes.sales IS 'sales tax allowed';
5
+ COMMENT ON COLUMN public.codes.srs IS 'flag denotes high risk object code per SRS';
6
+ COMMENT ON COLUMN public.invoices.number IS 'iLab-generated invoice number';
7
+ COMMIT;
@@ -20,22 +20,28 @@ CREATE TABLE public.system (
20
20
  "creditFee" text,
21
21
  part character varying(2),
22
22
  abbrev character varying(10),
23
- PRIMARY KEY("id")
23
+ aggiebuy character VARYING(255) DEFAULT NULL,
24
+ image text DEFAULT NULL,
25
+ PRIMARY KEY(id),
26
+ UNIQUE (part)
24
27
  );
25
- CREATE INDEX "system_part" ON "public"."system" USING btree ("part");
26
28
 
27
29
 
28
30
  -- Allow only one expense code per revenue code
29
31
  -- Expense codes do not need to be unique
32
+ -- srs flag denotes high risk object code per SRS
30
33
  CREATE TABLE public.codes (
31
34
  id integer GENERATED ALWAYS AS IDENTITY,
32
35
  revenue character varying(5),
33
36
  expense character varying(5),
34
37
  sales boolean DEFAULT FALSE NOT NULL,
35
- PRIMARY KEY("id"),
36
- UNIQUE("revenue")
38
+ srs boolean DEFAULT FALSE NOT NULL,
39
+ PRIMARY KEY(id),
40
+ UNIQUE(revenue)
37
41
  );
38
- CREATE INDEX "codes_expense" ON "public"."codes" USING btree ("expense");
42
+ CREATE INDEX codes_expense ON public.codes USING btree (expense);
43
+ COMMENT ON COLUMN public.codes.sales IS 'sales tax allowed';
44
+ COMMENT ON COLUMN public.codes.srs IS 'flag denotes high risk object code per SRS';
39
45
 
40
46
 
41
47
  CREATE TABLE public.cores (
@@ -47,15 +53,15 @@ CREATE TABLE public.cores (
47
53
  "corePhone" character varying(255),
48
54
  "coreAddress" text,
49
55
  "systemId" integer,
50
- "enabled" boolean DEFAULT FALSE NOT NULL,
56
+ enabled boolean DEFAULT FALSE NOT NULL,
51
57
  deleted timestamp with time zone,
52
58
  from_email character varying(255) NULL,
53
59
  invoice_email character varying(255) NULL,
54
- PRIMARY KEY("id"),
60
+ PRIMARY KEY(id),
55
61
  FOREIGN KEY ("systemId") REFERENCES public.system(id) ON DELETE CASCADE ON UPDATE CASCADE
56
62
  );
57
- CREATE INDEX "cores_account" ON "public"."cores" USING btree ("account");
58
- CREATE INDEX "cores_systemId" ON "public"."cores" USING btree ("systemId");
63
+ CREATE INDEX cores_account ON public.cores USING btree (account);
64
+ CREATE INDEX "cores_systemId" ON public.cores USING btree ("systemId");
59
65
 
60
66
 
61
67
  CREATE TABLE public.core_accounts (
@@ -71,10 +77,10 @@ CREATE INDEX core_accounts_core_id ON public.core_accounts USING btree ("coreId"
71
77
 
72
78
  CREATE TABLE public.invoices (
73
79
  uid character varying(29) NOT NULL,
74
- "number" character varying(255) NOT NULL,
80
+ number character varying(255) NOT NULL,
75
81
  lab text,
76
82
  "totalAmount" money NOT NULL,
77
- "date" date NOT NULL,
83
+ date date NOT NULL,
78
84
  "postedDate" date,
79
85
  data jsonb NOT NULL,
80
86
  replace_data jsonb DEFAULT NULL,
@@ -86,13 +92,13 @@ CREATE TABLE public.invoices (
86
92
  "customerAccount" character varying(13) NOT NULL,
87
93
  "sellingAccount" character varying(13) NOT NULL,
88
94
  fingerprint character(10),
89
- PRIMARY KEY("uid"),
95
+ PRIMARY KEY(uid),
90
96
  UNIQUE("famisInvoiceNumber")
91
97
  );
92
- COMMENT ON COLUMN public.invoices.number IS 'iLabs generated invoice number';
93
- CREATE INDEX "invoices_customerAccount" ON "public"."invoices" USING btree ("customerAccount");
94
- CREATE INDEX "invoices_number" ON "public"."invoices" USING btree ("number");
95
- CREATE INDEX "invoices_sellingAccount" ON "public"."invoices" USING btree ("sellingAccount");
98
+ COMMENT ON COLUMN public.invoices.number IS 'iLab-generated invoice number';
99
+ CREATE INDEX "invoices_customerAccount" ON public.invoices USING btree ("customerAccount");
100
+ CREATE INDEX invoices_number ON public.invoices USING btree (number);
101
+ CREATE INDEX "invoices_sellingAccount" ON public.invoices USING btree ("sellingAccount");
96
102
 
97
103
 
98
104
  CREATE TABLE public.users (
@@ -103,7 +109,7 @@ CREATE TABLE public.users (
103
109
  "roleName" character varying(255),
104
110
  "roleEmail" character varying(255),
105
111
  deleted timestamp with time zone,
106
- PRIMARY KEY("id"),
112
+ PRIMARY KEY(id),
107
113
  UNIQUE ("userId")
108
114
  );
109
115
 
@@ -113,7 +119,7 @@ CREATE TABLE public.user_cores (
113
119
  "coreId" integer NOT NULL,
114
120
  "userId" integer NOT NULL,
115
121
  email boolean DEFAULT FALSE NOT NULL,
116
- PRIMARY KEY("id"),
122
+ PRIMARY KEY(id),
117
123
  FOREIGN KEY ("coreId") REFERENCES public.cores(id) ON DELETE CASCADE ON UPDATE CASCADE,
118
124
  FOREIGN KEY ("userId") REFERENCES public.users(id) ON DELETE CASCADE ON UPDATE CASCADE
119
125
  );
@@ -127,7 +133,7 @@ CREATE TABLE public.user_systems (
127
133
  "systemId" integer NOT NULL,
128
134
  "userId" integer NOT NULL,
129
135
  email boolean DEFAULT FALSE NOT NULL,
130
- PRIMARY KEY("id"),
136
+ PRIMARY KEY(id),
131
137
  FOREIGN KEY ("systemId") REFERENCES public.system(id) ON DELETE CASCADE ON UPDATE CASCADE,
132
138
  FOREIGN KEY ("userId") REFERENCES public.users(id) ON DELETE CASCADE ON UPDATE CASCADE
133
139
  );
@@ -135,6 +141,34 @@ CREATE INDEX "user_systems_systemId" ON public.user_systems USING btree ("system
135
141
  CREATE INDEX "user_systems_userId" ON public.user_systems USING btree ("userId");
136
142
  CREATE UNIQUE INDEX "user_systems_systemId_userId" ON user_systems ("systemId", "userId");
137
143
 
144
+ CREATE TABLE IF NOT EXISTS public.invoice_comments (
145
+ id integer GENERATED ALWAYS AS IDENTITY,
146
+ uid character varying(29) NOT NULL,
147
+ invoice_id character varying(29) NOT NULL,
148
+ user_id integer NOT NULL,
149
+ comment text,
150
+ created_date timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
151
+ deleted timestamp with time zone DEFAULT NULL,
152
+ PRIMARY KEY(id),
153
+ UNIQUE(uid)
154
+ );
155
+ CREATE INDEX IF NOT EXISTS invoice_comments_invoice_id ON public.invoice_comments USING btree (invoice_id);
156
+ CREATE INDEX IF NOT EXISTS invoice_comments_user_id ON public.invoice_comments USING btree (user_id);
157
+
158
+ CREATE TABLE IF NOT EXISTS public.invoice_comment_files (
159
+ id integer GENERATED ALWAYS AS IDENTITY,
160
+ uid character varying(29) NOT NULL,
161
+ invoice_id character varying(29) NOT NULL,
162
+ comment_id character varying(29) NOT NULL,
163
+ original_filename text,
164
+ filename text,
165
+ created timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
166
+ deleted timestamp with time zone DEFAULT NULL,
167
+ PRIMARY KEY(id),
168
+ UNIQUE(uid)
169
+ );
170
+ CREATE INDEX IF NOT EXISTS invoice_comment_files_invoice_id ON public.invoice_comment_files USING btree (invoice_id);
171
+ CREATE INDEX IF NOT EXISTS invoice_comment_files_comment_id ON public.invoice_comment_files USING btree (comment_id);
138
172
 
139
173
  ALTER TABLE public.codes OWNER TO dba;
140
174
  ALTER TABLE public.cores OWNER TO dba;
@@ -147,9 +181,10 @@ ALTER TABLE public.user_systems OWNER TO dba;
147
181
  ALTER TABLE public.system OWNER TO dba;
148
182
 
149
183
  GRANT SELECT ON public.codes, public.cores, public.core_accounts, public.departments, public.invoices,
150
- public.users, public.user_cores, public.user_systems, public.system TO famis;
151
- GRANT INSERT, UPDATE ON public.codes, public.cores, public.invoices, public.users,
152
- public.user_cores, public.user_systems TO famis;
184
+ public.invoice_comment_files, public.invoice_comments, public.users, public.user_cores,
185
+ public.user_systems, public.system TO famis;
186
+ GRANT INSERT, UPDATE ON public.codes, public.cores, public.invoices, public.invoice_comment_files,
187
+ public.invoice_comments, public.users, public.user_cores, public.user_systems TO famis;
153
188
  GRANT DELETE ON public.codes, public.user_cores, public.user_systems TO famis;
154
189
 
155
190
  GRANT INSERT, TRUNCATE ON departments TO famisparser;
package/change.txt DELETED
@@ -1,123 +0,0 @@
1
- 60653d5 2020-01-22 **add RCPC** | Matthew Voss
2
- 927c699 2019-11-07 **bump version 1.1.8** | Matthew Voss
3
- 1c482a3 2019-11-07 **update schema** | Matthew Voss
4
- 781fde0 2019-11-06 **add column replace_data to invoices** | Matthew Voss
5
- d84d6a7 2019-11-04 **bump version 1.1.7** | Matthew Voss
6
- 3a0eee7 2019-11-04 **substring endpos is not inclusive** | Matthew Voss
7
- f64a7cc 2019-10-31 **bump version 1.1.6** | Matthew Voss
8
- d2290c0 2019-10-31 **only add the foreign key if it doesn't exist** | Andrew Daugherity
9
- eef90b2 2019-10-30 **fix account no. for IHTRASC** | Andrew Daugherity
10
- 6750337 2019-10-25 **add core_accounts table to schema** | Andrew Daugherity
11
- 41371e8 2019-10-24 **add CTCS & VMDL departments** | Andrew Daugherity
12
- b4b6c96 2019-10-31 **use the current account #** | Matthew Voss
13
- b2329f8 2019-10-31 **fix typo** | Matthew Voss
14
- 27c3d3e 2019-10-04 **version 1.1.5** | Matthew Voss
15
- e0d4dbc 2019-10-04 **add error if account misisng** | Matthew Voss
16
- 709b886 2019-10-04 **return part name and number** | Matthew Voss
17
- 73a79db 2019-10-03 **update schema and data** | Matthew Voss
18
- 7b7f69c 2019-10-03 **return object instead of array** | Matthew Voss
19
- 0083554 2019-10-01 **update dept. emails for PSYC & WESL** | Andrew Daugherity
20
- 0a1de24 2019-09-20 **version 1.1.4** | Matthew Voss
21
- 05776d0 2019-09-20 **update emails for BIOL, INEN, MEEN, & CVEN** | Matthew Voss
22
- 4304f16 2019-09-19 **return account balances** | Matthew Voss
23
- 7dc2077 2019-09-13 **use correct function name** | Matthew Voss
24
- cb804c5 2019-09-13 **update documentation** | Matthew Voss
25
- 6af25fd 2019-09-13 **use subcode_edits table** | Matthew Voss
26
- 9784b09 2019-09-13 **add getCurrentFiscalYear** | Matthew Voss
27
- b328002 2019-09-06 **rename getAccountByAccountNumber** | Matthew Voss
28
- 4673adc 2019-09-06 **rename searchAccountByAccountNumber** | Matthew Voss
29
- 9009267 2019-09-06 **change all occurances of fund(s) to account(s)** | Matthew Voss
30
- 2970ca5 2019-09-06 **use account_number** | Matthew Voss
31
- be1fa14 2019-09-06 **update getAllowableExpenseCodes** | Matthew Voss
32
- 9f53ea8 2019-09-06 **update allowableExpenseCode** | Matthew Voss
33
- e470d6d 2019-09-06 **update getFundsByResponsibleUin** | Matthew Voss
34
- 4dd7dca 2019-09-06 **update getFundsByUin** | Matthew Voss
35
- c2382bf 2019-09-06 **update searchFundByAccountNumber** | Matthew Voss
36
- 6250c94 2019-09-06 **update getFundByAccountNumber** | Matthew Voss
37
- e23b70a 2019-08-29 **version 1.1.2** | Matthew Voss
38
- 60f91dd 2019-08-29 **update knex package** | Matthew Voss
39
- 4054e16 2019-08-29 **combine query** | Matthew Voss
40
- 8d658c0 2019-08-29 **update migration sql** | Matthew Voss
41
- 047bf8c 2019-08-28 **update api docs** | Matthew Voss
42
- f98e0a5 2019-08-28 **add migration** | Matthew Voss
43
- fc4c66d 2019-08-28 **update/add new functions** | Matthew Voss
44
- 92e2e6f 2019-08-27 **update packages** | Matthew Voss
45
- bc3f27a 2019-07-18 **support non-TAMUS billing** | Matthew Voss
46
- b305e35 2019-07-10 **bump version** | Matthew Voss
47
- 3181052 2019-07-09 **join on funds.campusCode** | Matthew Voss
48
- ca26a83 2019-07-08 **fix table for user+system index** | Andrew Daugherity
49
- 1b2e75d 2019-07-08 **rename force_ar table and make columns NOT NULL** | Andrew Daugherity
50
- 67f508f 2019-07-08 **add unique indices for user+{core,system} combos** | Andrew Daugherity
51
- d6a78ce 2019-07-08 **revert changes to systemId for IBT cores** | Matthew Voss
52
- 79f21a7 2019-07-08 **migration** | Matthew Voss
53
- 17a00d1 2019-07-08 **update documentation** | Matthew Voss
54
- 6147b04 2019-07-08 **update initial data** | Matthew Voss
55
- 08a11d9 2019-07-08 **update schema** | Matthew Voss
56
- bd31ab1 2019-07-08 **suport for po numbers** | Matthew Voss
57
- 07d063d 2019-06-12 **add two more departments** | Andrew Daugherity
58
- d69cbf9 2019-06-11 **exclude id column in initial dept. data** | Andrew Daugherity
59
- 7e6b941 2019-06-11 **move departments data to a separate file** | Andrew Daugherity
60
- 18733fb 2019-06-11 **update migration** | Matthew Voss
61
- ba5b27c 2019-06-10 **simplify migration** | Matthew Voss
62
- bf6f932 2019-06-10 **udpate migration** | Matthew Voss
63
- 29d4f79 2019-06-10 **add indexes to departments** | Matthew Voss
64
- 99f8c56 2019-06-10 **add epay/idt email/id** | Matthew Voss
65
- 1ea29f4 2019-06-10 **added migration script for invoices** | Matthew Voss
66
- 49b5c6f 2019-06-10 **added core email for MIC** | Matthew Voss
67
- 4afb371 2019-06-10 **move create departments** | Matthew Voss
68
- 3072edd 2019-06-07 **add departments** | Matthew Voss
69
- d21c79f 2019-06-06 **update cores and invoices schemas** | Matthew Voss
70
- 392d2a4 2019-06-06 **add api endpoints** | Matthew Voss
71
- e6954a3 2019-05-30 **add apis and docs** | Matthew Voss
72
- 9acfb1e 2019-05-23 **start numbering at I300128** | Matthew Voss
73
- 587a8da 2019-05-22 **pass calculated value** | Matthew Voss
74
- ee65cca 2019-05-15 **use actual boolean values** | Matthew Voss
75
- 1103409 2019-05-15 **add insert,update on codes** | Matthew Voss
76
- 84ab8be 2019-05-14 **order by uid** | Matthew Voss
77
- 5864646 2019-05-14 **Merge branch 'rebase' (#2)** | Andrew Daugherity
78
- 9419a13 2019-05-14 **update documentation** | Matthew Voss
79
- d2c0e52 2019-05-14 **scripts to run documentation** | Matthew Voss
80
- 45c1664 2019-05-14 **mark by uid** | Matthew Voss
81
- 0ea2981 2019-05-14 **update by uid** | Matthew Voss
82
- aeb73c8 2019-05-14 **remove getInvoiceById** | Matthew Voss
83
- 57532b6 2019-05-14 **fix typo** | Matthew Voss
84
- 6389740 2019-05-14 **Update schema** | Matthew Voss
85
- cd91ce0 2019-05-14 **replace empty strings with NULL; update date** | Andrew Daugherity
86
- b0ccc40 2019-05-14 **restrict DB permissions** | Andrew Daugherity
87
- db437b0 2019-05-10 **remove id column** | Matthew Voss
88
- bcfe6f7 2019-05-03 **fix function typo** | Matthew Voss
89
- 76cf63b 2019-05-10 **fix initial data** | Matthew Voss
90
- f4230b3 2019-05-10 **remove id column use GENERATED ALWAYS closes issue #1** | Matthew Voss
91
- a283350 2019-05-03 **remove dup func** | Matthew Voss
92
- 59fd572 2019-05-03 **fix function typo** | Matthew Voss
93
- 4f5a11b 2019-05-03 **getAllowableExpenseCodes added** | Matthew Voss
94
- 6ce4d41 2019-05-02 **use proper table names** | Matthew Voss
95
- 48c5ec5 2019-05-01 **support boolean datatype** | Matthew Voss
96
- 38069d6 2019-05-01 **return all records** | Matthew Voss
97
- c43e418 2019-05-01 **set table owner to famis user** | Andrew Daugherity
98
- 320ab0b 2019-05-01 **remove trailing space** | Matthew Voss
99
- 447fb63 2019-05-01 **remove invalid html entities** | Matthew Voss
100
- 147a42d 2019-05-01 **quote number (SQL keyword)** | Matthew Voss
101
- c451b21 2019-05-01 **remove html entities** | Matthew Voss
102
- 0dbdbc6 2019-05-01 **update schema add role, roleName, roleEmail to users to support adding role accounts add email flags to user_cores & user_systems to flag email receipt** | Matthew Voss
103
- e5776de 2019-05-01 **add initial users** | Matthew Voss
104
- 7c922b1 2019-05-01 **set ON UPDATE CASCADE for foreign keys** | Andrew Daugherity
105
- 437e39d 2019-05-01 **update schema** | Matthew Voss
106
- a0f19e9 2019-05-01 **add enabled to data** | Matthew Voss
107
- d27e3b8 2019-05-01 **add enabled** | Matthew Voss
108
- 65c1e27 2019-05-01 **add getEnabledCores** | Matthew Voss
109
- 545dda6 2019-05-01 **update documentation** | Matthew Voss
110
- 903b0ef 2019-04-30 **add more api endpoints** | Matthew Voss
111
- 8c6b6c6 2019-04-30 **update schema** | Matthew Voss
112
- 91d1aed 2019-04-18 **link to api doc** | Matthew Voss
113
- bc247c6 2019-04-18 **initial data** | Matthew Voss
114
- cd671e3 2019-04-18 **combined schema** | Matthew Voss
115
- e382c37 2019-04-18 **delete separate schemas** | Matthew Voss
116
- ff112bc 2019-04-18 **organize docs** | Matthew Voss
117
- 02d6b6c 2019-04-18 **documentation** | Matthew Voss
118
- f472d8d 2019-04-18 **add readme** | Matthew Voss
119
- 54dc138 2019-04-18 **document code** | Matthew Voss
120
- 7ba5126 2019-04-18 **add db schemas** | Matthew Voss
121
- b27587a 2019-04-18 **expand api** | Matthew Voss
122
- 48f2206 2019-04-18 **add awaity** | Matthew Voss
123
- 8ca4cf0 2019-01-16 **initial commit** | Matthew Voss