diff --git a/api/resolvers/item.js b/api/resolvers/item.js
index cc34e4fc..f4a97c12 100644
--- a/api/resolvers/item.js
+++ b/api/resolvers/item.js
@@ -1311,6 +1311,9 @@ export const createItem = async (parent, { forward, options, ...item }, { me, mo
item.url = removeTracking(item.url)
}
+ // mark item as created with API key
+ item.apiKey = me?.apiKey
+
const uploadIds = uploadIdsFromText(item.text, { models })
const { totalFees: imgFees } = await imageFeesInfo(uploadIds, { models, me })
@@ -1433,7 +1436,7 @@ export const SELECT =
"Item".ncomments, "Item"."commentMsats", "Item"."lastCommentAt", "Item"."weightedVotes",
"Item"."weightedDownVotes", "Item".freebie, "Item".bio, "Item"."otsHash", "Item"."bountyPaidTo",
ltree2text("Item"."path") AS "path", "Item"."weightedComments", "Item"."imgproxyUrls", "Item".outlawed,
- "Item"."pollExpiresAt"`
+ "Item"."pollExpiresAt", "Item"."apiKey"`
function topOrderByWeightedSats (me, models) {
return `ORDER BY ${orderByNumerator(models)} DESC NULLS LAST, "Item".id DESC`
diff --git a/api/typeDefs/item.js b/api/typeDefs/item.js
index dd9a675d..9bbc1c00 100644
--- a/api/typeDefs/item.js
+++ b/api/typeDefs/item.js
@@ -125,6 +125,7 @@ export default gql`
forwards: [ItemForward]
imgproxyUrls: JSONObject
rel: String
+ apiKey: Boolean
}
input ItemForwardInput {
diff --git a/components/item-info.js b/components/item-info.js
index 234d24ad..430edac4 100644
--- a/components/item-info.js
+++ b/components/item-info.js
@@ -136,6 +136,9 @@ export default function ItemInfo ({
{' '}freebie
)}
+ {(item.apiKey &&
+ <>{' '}bot>
+ )}
{extraBadges}
{canEdit && !item.deletedAt &&
<>
diff --git a/fragments/comments.js b/fragments/comments.js
index 193dc7df..df9e927f 100644
--- a/fragments/comments.js
+++ b/fragments/comments.js
@@ -34,6 +34,7 @@ export const COMMENT_FIELDS = gql`
ncomments
imgproxyUrls
rel
+ apiKey
}
`
diff --git a/fragments/items.js b/fragments/items.js
index 9dd09d06..83785594 100644
--- a/fragments/items.js
+++ b/fragments/items.js
@@ -59,6 +59,7 @@ export const ITEM_FIELDS = gql`
mine
imgproxyUrls
rel
+ apiKey
}`
export const ITEM_FULL_FIELDS = gql`
diff --git a/prisma/migrations/20240529074650_item_bot_badge/migration.sql b/prisma/migrations/20240529074650_item_bot_badge/migration.sql
new file mode 100644
index 00000000..215285d0
--- /dev/null
+++ b/prisma/migrations/20240529074650_item_bot_badge/migration.sql
@@ -0,0 +1,2 @@
+-- AlterTable
+ALTER TABLE "Item" ADD COLUMN "apiKey" BOOLEAN NOT NULL DEFAULT false;
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index d72be919..c38d5cd3 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -419,6 +419,7 @@ model Item {
ItemUpload ItemUpload[]
uploadId Int?
outlawed Boolean @default(false)
+ apiKey Boolean @default(false)
pollExpiresAt DateTime?
Ancestors Reply[] @relation("AncestorReplyItem")
Replies Reply[]