Skip to content

Basinfy/Basinfy-SaaS-Studio / .agents/skills/saas-lgpd-consent-schema

saas-lgpd-consent-schema

Unverified

Design append-only versioned Prisma consent ledgers and auth hooks (LGPD Art. 8 & 9).

FileKindSize
SKILL.mdskill md5.0 KB
assets/consent-schema.prismaother3.0 KB

assets/consent-schema.prisma

View on GitHub
// Consent ledger — append-only, versioned, evidência forte.
// LGPD Art. 8 (consentimento), Art. 9 (informação), Art. 18, IX (revogação).

enum LegalBasis {
  CONSENT
  CONTRACT
  LEGAL_OBLIGATION
  PUBLIC_POLICY
  RESEARCH
  REGULAR_RIGHTS
  VITAL_PROTECTION
  HEALTH_TUTELAGE
  LEGITIMATE_INTEREST
  CREDIT_PROTECTION
}

enum ConsentStatus {
  GRANTED
  REVOKED
  EXPIRED
  SUPERSEDED // substituído por nova versão
}

enum ConsentChannel {
  WEB
  MOBILE_RN
  API
  SIGNUP
  SETTINGS_PAGE
  EMAIL_OPTIN
  COOKIE_BANNER
}

model PolicyVersion {
  id          String   @id @default(cuid())
  version     String   @unique // "v3.2"
  effectiveAt DateTime
  text        String   @db.Text
  textHash    String   // SHA-256 do texto canônico
  language    String   @default("pt-BR")
  changelog   String?  @db.Text

  consents    ConsentRecord[]

  @@index([effectiveAt])
}

model ConsentRecord {
  id              String        @id @default(cuid())

  // Quem
  subjectId       String        // FK lógica para User
  // O quê
  purpose         String        // "marketing_email", "personalization", "analytics", "biometric_auth"
  policyVersionId String
  policyVersion   PolicyVersion @relation(fields: [policyVersionId], references: [id])
  legalBasis      LegalBasis    @default(CONSENT)

  // Status
  status          ConsentStatus
  grantedAt       DateTime
  revokedAt       DateTime?
  expiresAt       DateTime?     // se houver TTL (raro, mas possível)

  // Evidência (Art. 8º, § 2º — controlador tem ônus de prova)
  evidenceHash    String        // SHA-256 do payload (IP+UA+timestamp+ui_snapshot)
  ipAddress       String?       @db.Inet
  userAgent       String?
  locale          String        @default("pt-BR")
  channel         ConsentChannel
  uiSnapshot      String?       @db.Text // HTML/screenshot hash do que foi mostrado

  // ECA Digital / Art. 14 LGPD
  isMinor         Boolean       @default(false)
  parentalConsent Boolean?
  guardianRef     String?       // FK lógica para Guardian

  // Propagação a operadores
  propagatedTo    Json?         // ["datadog", "mixpanel"]

  createdAt       DateTime      @default(now())

  @@index([subjectId, purpose, status])
  @@index([policyVersionId])
  @@index([grantedAt])
}

// Para ECA Digital — vinculação a responsável legal até 16 anos
model Guardian {
  id             String   @id @default(cuid())
  fullName       String
  cpf            String   // criptografado em aplicação
  email          String
  phone          String?
  relationship   String   // "mother", "father", "legal_guardian"
  verifiedAt     DateTime?
  verificationMethod String? // "id_doc", "video_call", "official_db"

  minors         MinorLink[]

  createdAt      DateTime @default(now())
}

model MinorLink {
  id          String   @id @default(cuid())
  minorUserId String
  guardianId  String
  guardian    Guardian @relation(fields: [guardianId], references: [id])
  active      Boolean  @default(true)
  createdAt   DateTime @default(now())
  endedAt     DateTime?

  @@unique([minorUserId, guardianId])
}
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall