Back to docs hub
Post & Social

Post visibility, edit, and soft delete

Tài liệu này mô tả slice hiện tại cho bài viết: lưu chế độ riêng tư ở bảng posts, sửa nội dung/chế độ bằng publicId, và xóa mềm thay vì xóa vật lý.

VisibilityPost

PUBLIC

Bài public. Đây là giá trị mặc định khi client không truyền visibility.

FRIEND

Friend nghĩa là mutual follow: tác giả và người xem follow nhau 2 chiều.

PRIVATE

Bài riêng tư của tác giả. Quyền xem chi tiết sẽ được enforce ở phase sau.

Slice này chỉ thêm dữ liệu và API để ghi/sửa visibility. Feed/detail chưa filter theo VisibilityPost; phần enforce quyền xem sẽ làm sau để tránh vội vàng làm sai policy.

API contract

POST /posts
{
  "content": "Hello Threads",
  "visibility": "PUBLIC"
}

PATCH /posts/:publicId
{
  "content": "Updated content",
  "visibility": "FRIEND"
}

DELETE /posts/:publicId

Database shape

enum VisibilityPost {
  PUBLIC
  FRIEND
  PRIVATE
}

model Post {
  visibility VisibilityPost @default(PUBLIC)
  isDeleted  Boolean        @default(false) @map("is_deleted")
  deletedAt  DateTime?      @map("deleted_at")
}