@frigear-nu/users 3.1.4 → 3.1.6

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 (101) hide show
  1. package/dist/module.d.mts +117 -1
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +144 -27
  4. package/dist/runtime/access.js +3 -3
  5. package/dist/runtime/app/components/UserCreateSlideover.vue +8 -6
  6. package/dist/runtime/app/components/UserPicker.d.vue.ts +2 -2
  7. package/dist/runtime/app/components/UserPicker.vue.d.ts +2 -2
  8. package/dist/runtime/app/components/UsersAdminTerms.d.vue.ts +7 -0
  9. package/dist/runtime/app/components/UsersAdminTerms.vue +55 -0
  10. package/dist/runtime/app/components/UsersAdminTerms.vue.d.ts +7 -0
  11. package/dist/runtime/app/components/UsersTermsGate.d.vue.ts +11 -0
  12. package/dist/runtime/app/components/UsersTermsGate.vue +82 -0
  13. package/dist/runtime/app/components/UsersTermsGate.vue.d.ts +11 -0
  14. package/dist/runtime/app/components/UsersTermsText.d.vue.ts +7 -0
  15. package/dist/runtime/app/components/UsersTermsText.vue +34 -0
  16. package/dist/runtime/app/components/UsersTermsText.vue.d.ts +7 -0
  17. package/dist/runtime/app/composables/useUserActions.d.ts +6 -2
  18. package/dist/runtime/app/composables/useUserActions.js +32 -3
  19. package/dist/runtime/app/pages/admin-user.vue +3 -0
  20. package/dist/runtime/app/pages/admin.vue +23 -5
  21. package/dist/runtime/app/pages/revert-email-change.vue +2 -1
  22. package/dist/runtime/app/plugins/offer-locale.client.js +22 -3
  23. package/dist/runtime/app/plugins/terms-gate.client.d.ts +2 -0
  24. package/dist/runtime/app/plugins/terms-gate.client.js +55 -0
  25. package/dist/runtime/app/tabs/Overview.vue +88 -14
  26. package/dist/runtime/app/utils/admin-user.d.ts +4 -2
  27. package/dist/runtime/app/utils/terms.d.ts +10 -0
  28. package/dist/runtime/app/utils/terms.js +7 -0
  29. package/dist/runtime/app/widgets/NewUsers.d.vue.ts +4 -1
  30. package/dist/runtime/app/widgets/NewUsers.vue +7 -4
  31. package/dist/runtime/app/widgets/NewUsers.vue.d.ts +4 -1
  32. package/dist/runtime/app/widgets/NewUsersStat.d.vue.ts +4 -1
  33. package/dist/runtime/app/widgets/NewUsersStat.vue +4 -1
  34. package/dist/runtime/app/widgets/NewUsersStat.vue.d.ts +4 -1
  35. package/dist/runtime/app/widgets/UsersAccountTerms.d.vue.ts +6 -0
  36. package/dist/runtime/app/widgets/UsersAccountTerms.vue +63 -0
  37. package/dist/runtime/app/widgets/UsersAccountTerms.vue.d.ts +6 -0
  38. package/dist/runtime/app/widgets/UsersRegisterTerms.d.vue.ts +9 -0
  39. package/dist/runtime/app/widgets/UsersRegisterTerms.vue +37 -0
  40. package/dist/runtime/app/widgets/UsersRegisterTerms.vue.d.ts +9 -0
  41. package/dist/runtime/db/schema.postgresql.d.ts +68 -0
  42. package/dist/runtime/db/schema.postgresql.js +15 -4
  43. package/dist/runtime/db/schema.sqlite.d.ts +72 -0
  44. package/dist/runtime/db/schema.sqlite.js +15 -4
  45. package/dist/runtime/db/terms-users.postgresql.d.ts +24 -0
  46. package/dist/runtime/db/terms-users.postgresql.js +4 -0
  47. package/dist/runtime/db/terms-users.sqlite.d.ts +26 -0
  48. package/dist/runtime/db/terms-users.sqlite.js +4 -0
  49. package/dist/runtime/db/terms.postgresql.d.ts +162 -0
  50. package/dist/runtime/db/terms.postgresql.js +21 -0
  51. package/dist/runtime/db/terms.sqlite.d.ts +173 -0
  52. package/dist/runtime/db/terms.sqlite.js +21 -0
  53. package/dist/runtime/i18n/lang/da.json +85 -6
  54. package/dist/runtime/i18n/lang/en.json +85 -6
  55. package/dist/runtime/server/plugins/terms-claims.d.ts +13 -0
  56. package/dist/runtime/server/plugins/terms-claims.js +19 -0
  57. package/dist/runtime/server/plugins/terms.d.ts +15 -0
  58. package/dist/runtime/server/plugins/terms.js +43 -0
  59. package/dist/runtime/server/routes/admin/user-avatar.delete.d.ts +2 -0
  60. package/dist/runtime/server/routes/admin/user-avatar.delete.js +11 -0
  61. package/dist/runtime/server/routes/admin/user-terms.get.d.ts +2 -0
  62. package/dist/runtime/server/routes/admin/user-terms.get.js +12 -0
  63. package/dist/runtime/server/routes/admin/user.delete.js +2 -0
  64. package/dist/runtime/server/routes/admin/user.patch.js +14 -3
  65. package/dist/runtime/server/routes/admin/users.get.js +11 -3
  66. package/dist/runtime/server/routes/admin/users.post.js +1 -0
  67. package/dist/runtime/server/routes/avatar.get.d.ts +2 -0
  68. package/dist/runtime/server/routes/avatar.get.js +12 -0
  69. package/dist/runtime/server/routes/me/avatar.delete.d.ts +2 -0
  70. package/dist/runtime/server/routes/me/avatar.delete.js +13 -0
  71. package/dist/runtime/server/routes/me/avatar.put.d.ts +2 -0
  72. package/dist/runtime/server/routes/me/avatar.put.js +20 -0
  73. package/dist/runtime/server/routes/me/profile.patch.js +23 -4
  74. package/dist/runtime/server/routes/me/terms.get.d.ts +2 -0
  75. package/dist/runtime/server/routes/me/terms.get.js +4 -0
  76. package/dist/runtime/server/routes/me/terms.post.d.ts +2 -0
  77. package/dist/runtime/server/routes/me/terms.post.js +18 -0
  78. package/dist/runtime/server/schemas.d.ts +12 -1
  79. package/dist/runtime/server/schemas.js +6 -1
  80. package/dist/runtime/server/search-index.js +2 -2
  81. package/dist/runtime/server/user-store.js +2 -1
  82. package/dist/runtime/server/utils/dto.d.ts +5 -1
  83. package/dist/runtime/server/utils/dto.js +8 -0
  84. package/dist/runtime/server/utils/user-refs.d.ts +2 -1
  85. package/dist/runtime/server/utils/user-refs.js +8 -2
  86. package/dist/runtime/server/utils/user-search.d.ts +13 -5
  87. package/dist/runtime/server/utils/user-search.js +13 -1
  88. package/dist/runtime/server/utils/users-avatar.d.ts +29 -0
  89. package/dist/runtime/server/utils/users-avatar.js +69 -0
  90. package/dist/runtime/server/utils/users-terms.d.ts +35 -0
  91. package/dist/runtime/server/utils/users-terms.js +90 -0
  92. package/dist/runtime/utils/api.d.ts +25 -4
  93. package/dist/runtime/utils/api.js +23 -3
  94. package/dist/runtime/utils/avatar.d.ts +25 -0
  95. package/dist/runtime/utils/avatar.js +23 -0
  96. package/dist/runtime/utils/profile.d.ts +14 -0
  97. package/dist/runtime/utils/profile.js +8 -0
  98. package/dist/runtime/utils/terms-claim.d.ts +27 -0
  99. package/dist/runtime/utils/terms-claim.js +15 -0
  100. package/dist/types.d.mts +1 -1
  101. package/package.json +18 -13
@@ -0,0 +1,10 @@
1
+ /** A part of a sentence: plain text, or the link named by its placeholder. */
2
+ export type UsersTermsTextPart = {
3
+ text: string;
4
+ } | {
5
+ link: string;
6
+ };
7
+ /** The placeholder values to translate a sentence with, so `splitUsersTermsText` can find the links again. */
8
+ export declare function usersTermsLinkParams(...names: string[]): Record<string, string>;
9
+ /** `translated` (made with `usersTermsLinkParams`) cut into text and link parts, in order. */
10
+ export declare function splitUsersTermsText(translated: string): UsersTermsTextPart[];
@@ -0,0 +1,7 @@
1
+ const MARK = "\uE000";
2
+ export function usersTermsLinkParams(...names) {
3
+ return Object.fromEntries(names.map((name) => [name, `${MARK}${name}${MARK}`]));
4
+ }
5
+ export function splitUsersTermsText(translated) {
6
+ return translated.split(new RegExp(`${MARK}([^${MARK}]+)${MARK}`)).map((piece, index) => index % 2 ? { link: piece } : { text: piece }).filter((part) => "link" in part || part.text);
7
+ }
@@ -1,3 +1,6 @@
1
- declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
1
+ type __VLS_Props = {
2
+ framed?: boolean;
3
+ };
4
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
2
5
  declare const _default: typeof __VLS_export;
3
6
  export default _default;
@@ -2,6 +2,9 @@
2
2
  import { usersApi } from "../../utils/api";
3
3
  import { statusColor, useFormat, useLazyFetch, useLocaleLink, useModuleT, useRuntimeConfig } from "#imports";
4
4
  defineOptions({ name: "UsersNewUsersWidget" });
5
+ defineProps({
6
+ framed: { type: Boolean, required: false }
7
+ });
5
8
  const t = useModuleT("users");
6
9
  const format = useFormat();
7
10
  const { localize } = useLocaleLink();
@@ -12,11 +15,11 @@ const { data: users, status } = useLazyFetch(usersApi.admin.new, { key: "admin-u
12
15
 
13
16
  <template>
14
17
  <ListCard
15
- :title="t('admin.newUsers.title', 'New users')"
18
+ :title="framed ? void 0 : t('admin.newUsers.title', 'New users')"
16
19
  :description="t('admin.newUsers.description', 'Signed up in the last 30 days.')"
17
- :loading="status === 'pending' && !users?.length"
18
- :is-empty="!users?.length"
19
- :empty="t('admin.newUsers.empty', 'Nobody new yet.')"
20
+ :loading="(status === 'pending' || status === 'idle') && !users?.length"
21
+ :is-empty="(status === 'success' || status === 'error') && !users?.length"
22
+ :empty="status === 'error' ? t('admin.newUsers.error', 'Could not load the new users.') : t('admin.newUsers.empty', 'Nobody new yet.')"
20
23
  :to="listPath"
21
24
  :to-label="t('admin.allUsers', 'All users')"
22
25
  >
@@ -1,3 +1,6 @@
1
- declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
1
+ type __VLS_Props = {
2
+ framed?: boolean;
3
+ };
4
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
2
5
  declare const _default: typeof __VLS_export;
3
6
  export default _default;
@@ -1,3 +1,6 @@
1
- declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
1
+ type __VLS_Props = {
2
+ framed?: boolean;
3
+ };
4
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
2
5
  declare const _default: typeof __VLS_export;
3
6
  export default _default;
@@ -2,6 +2,9 @@
2
2
  import { usersApi } from "../../utils/api";
3
3
  import { useLazyFetch, useLocaleLink, useModuleT, useRuntimeConfig } from "#imports";
4
4
  defineOptions({ name: "UsersNewUsersStat" });
5
+ defineProps({
6
+ framed: { type: Boolean, required: false }
7
+ });
5
8
  const t = useModuleT("users");
6
9
  const { localize } = useLocaleLink();
7
10
  const adminPage = useRuntimeConfig().public.users?.pages?.admin;
@@ -10,7 +13,7 @@ const { data: stats, status } = useLazyFetch(usersApi.admin.stats, { key: "admin
10
13
 
11
14
  <template>
12
15
  <StatCard
13
- :label="t('admin.stats.newUsers', 'New users')"
16
+ :label="framed ? void 0 : t('admin.stats.newUsers', 'New users')"
14
17
  icon="i-lucide-user-plus"
15
18
  :value="stats?.newUsers"
16
19
  :hint="stats ? t('admin.stats.ofTotal', '{total} users in total', { total: stats.total }) : void 0"
@@ -1,3 +1,6 @@
1
- declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
1
+ type __VLS_Props = {
2
+ framed?: boolean;
3
+ };
4
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
2
5
  declare const _default: typeof __VLS_export;
3
6
  export default _default;
@@ -0,0 +1,6 @@
1
+ type __VLS_Props = {
2
+ user?: unknown;
3
+ };
4
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
5
+ declare const _default: typeof __VLS_export;
6
+ export default _default;
@@ -0,0 +1,63 @@
1
+ <script setup>
2
+ import { computed } from "vue";
3
+ import { usersApi } from "../../utils/api";
4
+ import { useFormat, useLazyFetch, useLocaleLink, useModuleT } from "#imports";
5
+ defineOptions({ name: "UsersAccountTerms" });
6
+ defineProps({
7
+ user: { type: null, required: false }
8
+ });
9
+ const t = useModuleT("users");
10
+ const format = useFormat();
11
+ const { localize } = useLocaleLink();
12
+ const { data, status, error } = useLazyFetch(usersApi.me.terms, { key: "users:me:terms" });
13
+ const loading = computed(() => status.value === "pending" && !data.value);
14
+ const summary = computed(() => {
15
+ const accepted = data.value?.accepted;
16
+ if (!accepted) return t("terms.account.none", "You have not accepted the terms yet.");
17
+ return t("terms.account.accepted", "You accepted version {version} on {date}.", { version: accepted.version, date: format.dateTime(accepted.acceptedAt) });
18
+ });
19
+ </script>
20
+
21
+ <template>
22
+ <SectionCard
23
+ :title="t('terms.account.title', 'Terms')"
24
+ :description="t('terms.account.description', 'The terms you accepted for using this site.')"
25
+ :loading="loading"
26
+ >
27
+ <UAlert
28
+ v-if="error"
29
+ color="error"
30
+ variant="subtle"
31
+ icon="i-lucide-circle-alert"
32
+ :title="t('terms.account.loadFailed', 'Your terms could not be loaded.')"
33
+ />
34
+ <div
35
+ v-else-if="data"
36
+ class="flex flex-col gap-2 text-sm"
37
+ data-users-account-terms
38
+ >
39
+ <p class="text-highlighted">
40
+ {{ summary }}
41
+ </p>
42
+ <p
43
+ v-if="data.accepted && !data.upToDate"
44
+ class="text-muted"
45
+ >
46
+ {{ t("terms.account.outdated", "The terms have changed since (version {version}).", { version: data.current.version }) }}
47
+ </p>
48
+ </div>
49
+ <template #footer>
50
+ <div class="flex justify-end">
51
+ <UButton
52
+ color="neutral"
53
+ variant="outline"
54
+ icon="i-lucide-scroll-text"
55
+ :to="localize(data?.current.url ?? '')"
56
+ target="_blank"
57
+ :disabled="!data"
58
+ :label="t('terms.account.read', 'Read the terms')"
59
+ />
60
+ </div>
61
+ </template>
62
+ </SectionCard>
63
+ </template>
@@ -0,0 +1,6 @@
1
+ type __VLS_Props = {
2
+ user?: unknown;
3
+ };
4
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
5
+ declare const _default: typeof __VLS_export;
6
+ export default _default;
@@ -0,0 +1,9 @@
1
+ type __VLS_Props = {
2
+ /** From the registration form: puts a value under the module's key of the request's `extras`. */
3
+ setExtra: (module: string, value: unknown) => void;
4
+ /** From the registration form: keeps it from being sent while `blocked`. Missing in older versions of auth. */
5
+ setBlocked?: (module: string, blocked: boolean) => void;
6
+ };
7
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
+ declare const _default: typeof __VLS_export;
9
+ export default _default;
@@ -0,0 +1,37 @@
1
+ <script setup>
2
+ import { computed, onBeforeUnmount, ref, watch } from "vue";
3
+ import UsersTermsText from "../components/UsersTermsText.vue";
4
+ import { useNuxtApp, useRuntimeConfig } from "#imports";
5
+ defineOptions({ name: "UsersRegisterTerms" });
6
+ const props = defineProps({
7
+ setExtra: { type: Function, required: true },
8
+ setBlocked: { type: Function, required: false }
9
+ });
10
+ const terms = useRuntimeConfig().public.users?.terms;
11
+ const i18n = useNuxtApp().$i18n;
12
+ const accepted = ref(false);
13
+ const locale = computed(() => i18n?.locale?.value);
14
+ watch([accepted, locale], ([value]) => {
15
+ if (!terms) return;
16
+ props.setExtra("users", value ? { termsVersion: terms.version, ...locale.value ? { locale: locale.value } : {} } : void 0);
17
+ props.setBlocked?.("users", !value);
18
+ }, { immediate: true });
19
+ onBeforeUnmount(() => {
20
+ props.setExtra("users", void 0);
21
+ props.setBlocked?.("users", false);
22
+ });
23
+ </script>
24
+
25
+ <template>
26
+ <UCheckbox
27
+ v-if="terms"
28
+ v-model="accepted"
29
+ name="users-terms"
30
+ required
31
+ data-users-register-terms
32
+ >
33
+ <template #label>
34
+ <UsersTermsText :terms="terms" />
35
+ </template>
36
+ </UCheckbox>
37
+ </template>
@@ -0,0 +1,9 @@
1
+ type __VLS_Props = {
2
+ /** From the registration form: puts a value under the module's key of the request's `extras`. */
3
+ setExtra: (module: string, value: unknown) => void;
4
+ /** From the registration form: keeps it from being sent while `blocked`. Missing in older versions of auth. */
5
+ setBlocked?: (module: string, blocked: boolean) => void;
6
+ };
7
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
+ declare const _default: typeof __VLS_export;
9
+ export default _default;
@@ -36,6 +36,23 @@ export declare const users: import("drizzle-orm/pg-core").PgTableWithColumns<{
36
36
  identity: undefined;
37
37
  generated: undefined;
38
38
  }, {}, {}>;
39
+ nickname: import("drizzle-orm/pg-core").PgColumn<{
40
+ name: "nickname";
41
+ tableName: "users";
42
+ dataType: "string";
43
+ columnType: "PgText";
44
+ data: string;
45
+ driverParam: string;
46
+ notNull: false;
47
+ hasDefault: false;
48
+ isPrimaryKey: false;
49
+ isAutoincrement: false;
50
+ hasRuntimeDefault: false;
51
+ enumValues: [string, ...string[]];
52
+ baseColumn: never;
53
+ identity: undefined;
54
+ generated: undefined;
55
+ }, {}, {}>;
39
56
  searchText: import("drizzle-orm/pg-core").PgColumn<{
40
57
  name: "searchText";
41
58
  tableName: "users";
@@ -104,6 +121,57 @@ export declare const users: import("drizzle-orm/pg-core").PgTableWithColumns<{
104
121
  identity: undefined;
105
122
  generated: undefined;
106
123
  }, {}, {}>;
124
+ peopleNumber: import("drizzle-orm/pg-core").PgColumn<{
125
+ name: "peopleNumber";
126
+ tableName: "users";
127
+ dataType: "string";
128
+ columnType: "PgText";
129
+ data: string;
130
+ driverParam: string;
131
+ notNull: false;
132
+ hasDefault: false;
133
+ isPrimaryKey: false;
134
+ isAutoincrement: false;
135
+ hasRuntimeDefault: false;
136
+ enumValues: [string, ...string[]];
137
+ baseColumn: never;
138
+ identity: undefined;
139
+ generated: undefined;
140
+ }, {}, {}>;
141
+ photoOptOut: import("drizzle-orm/pg-core").PgColumn<{
142
+ name: "photoOptOut";
143
+ tableName: "users";
144
+ dataType: "boolean";
145
+ columnType: "PgBoolean";
146
+ data: boolean;
147
+ driverParam: boolean;
148
+ notNull: true;
149
+ hasDefault: true;
150
+ isPrimaryKey: false;
151
+ isAutoincrement: false;
152
+ hasRuntimeDefault: false;
153
+ enumValues: undefined;
154
+ baseColumn: never;
155
+ identity: undefined;
156
+ generated: undefined;
157
+ }, {}, {}>;
158
+ tagOptOut: import("drizzle-orm/pg-core").PgColumn<{
159
+ name: "tagOptOut";
160
+ tableName: "users";
161
+ dataType: "boolean";
162
+ columnType: "PgBoolean";
163
+ data: boolean;
164
+ driverParam: boolean;
165
+ notNull: true;
166
+ hasDefault: true;
167
+ isPrimaryKey: false;
168
+ isAutoincrement: false;
169
+ hasRuntimeDefault: false;
170
+ enumValues: undefined;
171
+ baseColumn: never;
172
+ identity: undefined;
173
+ generated: undefined;
174
+ }, {}, {}>;
107
175
  locale: import("drizzle-orm/pg-core").PgColumn<{
108
176
  name: "locale";
109
177
  tableName: "users";
@@ -1,17 +1,28 @@
1
- import { pgTable, text, serial, bigint, timestamp } from "drizzle-orm/pg-core";
1
+ import { pgTable, text, serial, bigint, timestamp, boolean, index } from "drizzle-orm/pg-core";
2
2
  export const users = pgTable("users", {
3
3
  id: serial().primaryKey(),
4
4
  name: text().notNull(),
5
- // `name` folded for search (`searchText` of `@frigear-nu/module-kit/server`), written with it: `searchUserRefs` and
6
- // other modules' user searches match it.
5
+ // What the user likes to be called, next to their name (at most 50 characters).
6
+ nickname: text(),
7
+ // `name` and `nickname` folded for search (`searchText` of `@frigear-nu/module-kit/server`), written with them
8
+ // (`withUserSearchText`): `searchUserRefs` and other modules' user searches match it.
7
9
  searchText: text().notNull().default(""),
8
10
  email: text().notNull().unique(),
9
11
  avatar: text(),
10
12
  // Personal data: shown to staff with `users:pii` only, and to other modules' staff through their own `:pii`.
11
13
  phone: text(),
14
+ // The person's id in an external system (e.g. an event's volunteer system), trimmed, at most 64 characters. Typed in
15
+ // by the user or staff, so not unique: imports matching on it report duplicates. Personal data, like `phone`.
16
+ peopleNumber: text(),
17
+ // The user's own choices: no photos with them as the main subject, and no tagging of them in posts and photos online.
18
+ // Staff and team leads see them; only the user changes them.
19
+ photoOptOut: boolean().notNull().default(false),
20
+ tagOptOut: boolean().notNull().default(false),
12
21
  // The user's language (an i18n locale code such as `da`, or a short BCP-47 tag): messages to them use it.
13
22
  locale: text(),
14
23
  acceptedTermsAt: bigint("accepted_terms_at", { mode: "number" }),
15
24
  createdAt: timestamp({ withTimezone: true }).notNull().$defaultFn(() => /* @__PURE__ */ new Date()),
16
25
  updatedAt: timestamp({ withTimezone: true }).notNull().$onUpdateFn(() => /* @__PURE__ */ new Date())
17
- });
26
+ }, (t) => [
27
+ index("users_people_number_idx").on(t.peopleNumber)
28
+ ]);
@@ -38,6 +38,25 @@ export declare const users: import("drizzle-orm/sqlite-core").SQLiteTableWithCol
38
38
  }, {}, {
39
39
  length: undefined;
40
40
  }>;
41
+ nickname: import("drizzle-orm/sqlite-core").SQLiteColumn<{
42
+ name: "nickname";
43
+ tableName: "users";
44
+ dataType: "string";
45
+ columnType: "SQLiteText";
46
+ data: string;
47
+ driverParam: string;
48
+ notNull: false;
49
+ hasDefault: false;
50
+ isPrimaryKey: false;
51
+ isAutoincrement: false;
52
+ hasRuntimeDefault: false;
53
+ enumValues: [string, ...string[]];
54
+ baseColumn: never;
55
+ identity: undefined;
56
+ generated: undefined;
57
+ }, {}, {
58
+ length: undefined;
59
+ }>;
41
60
  searchText: import("drizzle-orm/sqlite-core").SQLiteColumn<{
42
61
  name: "searchText";
43
62
  tableName: "users";
@@ -114,6 +133,59 @@ export declare const users: import("drizzle-orm/sqlite-core").SQLiteTableWithCol
114
133
  }, {}, {
115
134
  length: undefined;
116
135
  }>;
136
+ peopleNumber: import("drizzle-orm/sqlite-core").SQLiteColumn<{
137
+ name: "peopleNumber";
138
+ tableName: "users";
139
+ dataType: "string";
140
+ columnType: "SQLiteText";
141
+ data: string;
142
+ driverParam: string;
143
+ notNull: false;
144
+ hasDefault: false;
145
+ isPrimaryKey: false;
146
+ isAutoincrement: false;
147
+ hasRuntimeDefault: false;
148
+ enumValues: [string, ...string[]];
149
+ baseColumn: never;
150
+ identity: undefined;
151
+ generated: undefined;
152
+ }, {}, {
153
+ length: undefined;
154
+ }>;
155
+ photoOptOut: import("drizzle-orm/sqlite-core").SQLiteColumn<{
156
+ name: "photoOptOut";
157
+ tableName: "users";
158
+ dataType: "boolean";
159
+ columnType: "SQLiteBoolean";
160
+ data: boolean;
161
+ driverParam: number;
162
+ notNull: true;
163
+ hasDefault: true;
164
+ isPrimaryKey: false;
165
+ isAutoincrement: false;
166
+ hasRuntimeDefault: false;
167
+ enumValues: undefined;
168
+ baseColumn: never;
169
+ identity: undefined;
170
+ generated: undefined;
171
+ }, {}, {}>;
172
+ tagOptOut: import("drizzle-orm/sqlite-core").SQLiteColumn<{
173
+ name: "tagOptOut";
174
+ tableName: "users";
175
+ dataType: "boolean";
176
+ columnType: "SQLiteBoolean";
177
+ data: boolean;
178
+ driverParam: number;
179
+ notNull: true;
180
+ hasDefault: true;
181
+ isPrimaryKey: false;
182
+ isAutoincrement: false;
183
+ hasRuntimeDefault: false;
184
+ enumValues: undefined;
185
+ baseColumn: never;
186
+ identity: undefined;
187
+ generated: undefined;
188
+ }, {}, {}>;
117
189
  locale: import("drizzle-orm/sqlite-core").SQLiteColumn<{
118
190
  name: "locale";
119
191
  tableName: "users";
@@ -1,17 +1,28 @@
1
- import { sqliteTable, text, integer } from "drizzle-orm/sqlite-core";
1
+ import { sqliteTable, text, integer, index } from "drizzle-orm/sqlite-core";
2
2
  export const users = sqliteTable("users", {
3
3
  id: integer().primaryKey({ autoIncrement: true }),
4
4
  name: text().notNull(),
5
- // `name` folded for search (`searchText` of `@frigear-nu/module-kit/server`), written with it: `searchUserRefs` and
6
- // other modules' user searches match it.
5
+ // What the user likes to be called, next to their name (at most 50 characters).
6
+ nickname: text(),
7
+ // `name` and `nickname` folded for search (`searchText` of `@frigear-nu/module-kit/server`), written with them
8
+ // (`withUserSearchText`): `searchUserRefs` and other modules' user searches match it.
7
9
  searchText: text().notNull().default(""),
8
10
  email: text().notNull().unique(),
9
11
  avatar: text(),
10
12
  // Personal data: shown to staff with `users:pii` only, and to other modules' staff through their own `:pii`.
11
13
  phone: text(),
14
+ // The person's id in an external system (e.g. an event's volunteer system), trimmed, at most 64 characters. Typed in
15
+ // by the user or staff, so not unique: imports matching on it report duplicates. Personal data, like `phone`.
16
+ peopleNumber: text(),
17
+ // The user's own choices: no photos with them as the main subject, and no tagging of them in posts and photos online.
18
+ // Staff and team leads see them; only the user changes them.
19
+ photoOptOut: integer({ mode: "boolean" }).notNull().default(false),
20
+ tagOptOut: integer({ mode: "boolean" }).notNull().default(false),
12
21
  // The user's language (an i18n locale code such as `da`, or a short BCP-47 tag): messages to them use it.
13
22
  locale: text(),
14
23
  acceptedTermsAt: integer("accepted_terms_at"),
15
24
  createdAt: integer({ mode: "timestamp" }).notNull().$defaultFn(() => /* @__PURE__ */ new Date()),
16
25
  updatedAt: integer({ mode: "timestamp" }).notNull().$onUpdateFn(() => /* @__PURE__ */ new Date())
17
- });
26
+ }, (t) => [
27
+ index("users_people_number_idx").on(t.peopleNumber)
28
+ ]);
@@ -0,0 +1,24 @@
1
+ export declare const users: import("drizzle-orm/pg-core").PgTableWithColumns<{
2
+ name: "users";
3
+ schema: undefined;
4
+ columns: {
5
+ acceptedTermsVersion: import("drizzle-orm/pg-core").PgColumn<{
6
+ name: "accepted_terms_version";
7
+ tableName: "users";
8
+ dataType: "string";
9
+ columnType: "PgText";
10
+ data: string;
11
+ driverParam: string;
12
+ notNull: false;
13
+ hasDefault: false;
14
+ isPrimaryKey: false;
15
+ isAutoincrement: false;
16
+ hasRuntimeDefault: false;
17
+ enumValues: [string, ...string[]];
18
+ baseColumn: never;
19
+ identity: undefined;
20
+ generated: undefined;
21
+ }, {}, {}>;
22
+ };
23
+ dialect: "pg";
24
+ }>;
@@ -0,0 +1,4 @@
1
+ import { pgTable, text } from "drizzle-orm/pg-core";
2
+ export const users = pgTable("users", {
3
+ acceptedTermsVersion: text("accepted_terms_version")
4
+ });
@@ -0,0 +1,26 @@
1
+ export declare const users: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
2
+ name: "users";
3
+ schema: undefined;
4
+ columns: {
5
+ acceptedTermsVersion: import("drizzle-orm/sqlite-core").SQLiteColumn<{
6
+ name: "accepted_terms_version";
7
+ tableName: "users";
8
+ dataType: "string";
9
+ columnType: "SQLiteText";
10
+ data: string;
11
+ driverParam: string;
12
+ notNull: false;
13
+ hasDefault: false;
14
+ isPrimaryKey: false;
15
+ isAutoincrement: false;
16
+ hasRuntimeDefault: false;
17
+ enumValues: [string, ...string[]];
18
+ baseColumn: never;
19
+ identity: undefined;
20
+ generated: undefined;
21
+ }, {}, {
22
+ length: number | undefined;
23
+ }>;
24
+ };
25
+ dialect: "sqlite";
26
+ }>;
@@ -0,0 +1,4 @@
1
+ import { sqliteTable, text } from "drizzle-orm/sqlite-core";
2
+ export const users = sqliteTable("users", {
3
+ acceptedTermsVersion: text("accepted_terms_version")
4
+ });