Add member identifiers table for ID documents (DL, passport, school ID)

member_identifier table with type, value, issuing authority, expiry,
front/back image storage (base64 in Postgres), primary flag. CRUD
endpoints under /members/:memberId/identifiers. Zod schemas with
constrained type enum.
This commit is contained in:
Ryan Moon
2026-03-28 09:38:01 -05:00
parent 727275af59
commit c7b460c0bf
7 changed files with 208 additions and 0 deletions

View File

@@ -62,6 +62,31 @@ export const members = pgTable('member', {
updatedAt: timestamp('updated_at', { withTimezone: true }).notNull().defaultNow(),
})
export const memberIdentifiers = pgTable('member_identifier', {
id: uuid('id').primaryKey().defaultRandom(),
memberId: uuid('member_id')
.notNull()
.references(() => members.id),
companyId: uuid('company_id')
.notNull()
.references(() => companies.id),
type: varchar('type', { length: 50 }).notNull(),
label: varchar('label', { length: 100 }),
value: varchar('value', { length: 255 }).notNull(),
issuingAuthority: varchar('issuing_authority', { length: 255 }),
issuedDate: date('issued_date'),
expiresAt: date('expires_at'),
imageFront: text('image_front'),
imageBack: text('image_back'),
notes: text('notes'),
isPrimary: boolean('is_primary').notNull().default(false),
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
updatedAt: timestamp('updated_at', { withTimezone: true }).notNull().defaultNow(),
})
export type MemberIdentifier = typeof memberIdentifiers.$inferSelect
export type MemberIdentifierInsert = typeof memberIdentifiers.$inferInsert
export const processorEnum = pgEnum('payment_processor', ['stripe', 'global_payments'])
export const accountProcessorLinks = pgTable('account_processor_link', {