Ulf Gebhardt 8cf405c549
feat(backend): badges (#8391)
* delete all old badges

* reward/unrewardBadge

* verification Badges

* name all badged accordingly

* more tests, lint

* seed badges

* profileBadge mechanic

* badgesUnusedCount

* seed profileBadges set

* configure profile badge count

* insert badges db:data:badges:default

* seed commands to seed default badges and allow to seed branding data

* copy data migrations when building docker

* typo

* correct data:branding command & document it

* test new functionality

* Update backend/src/db/seed/badges.ts

Co-authored-by: Max <maxharz@gmail.com>

* Update backend/src/db/seed/badges.ts

Co-authored-by: Max <maxharz@gmail.com>

* Update backend/src/db/seed/badges.ts

Co-authored-by: Max <maxharz@gmail.com>

* naming coventions

* final naming fix

lint

fix build

fix badge type in test

renamed badge_ to trophy_

lint fixes

small renameing

fixes

fix users spec

fix webapp queries

fix display

* expose badge description

---------

Co-authored-by: Max <maxharz@gmail.com>
2025-04-17 23:08:54 +00:00

142 lines
2.0 KiB
JavaScript

import gql from 'graphql-tag'
export const userFragment = gql`
fragment user on User {
id
slug
name
avatar {
url
}
disabled
deleted
}
`
export const locationFragment = (lang) => gql`
fragment location on User {
locationName
location {
name: name${lang}
lng
lat
}
}
`
export const badgesFragment = gql`
fragment badges on User {
badgeTrophies {
id
icon
}
}
`
export const userCountsFragment = gql`
fragment userCounts on User {
shoutedCount
contributionsCount
commentedCount
followedByCount
followingCount
followedByCurrentUser
}
`
export const postFragment = gql`
fragment post on Post {
id
title
content
contentExcerpt
createdAt
updatedAt
disabled
deleted
slug
language
image {
url
sensitive
aspectRatio
type
}
author {
...user
}
pinnedAt
pinned
isObservedByMe
observingUsersCount
}
`
export const groupFragment = gql`
fragment group on Group {
id
groupName: name
slug
disabled
deleted
about
description
descriptionExcerpt
groupType
actionRadius
categories {
id
slug
name
icon
}
locationName
myRole
}
`
export const postCountsFragment = gql`
fragment postCounts on Post {
commentsCount
shoutedCount
shoutedByCurrentUser
emotionsCount
clickedCount
viewedTeaserCount
viewedTeaserByCurrentUser
}
`
export const tagsCategoriesAndPinnedFragment = gql`
fragment tagsCategoriesAndPinned on Post {
tags {
id
}
categories {
id
slug
name
icon
}
pinnedBy {
id
name
role
}
}
`
export const commentFragment = gql`
fragment comment on Comment {
id
createdAt
updatedAt
disabled
deleted
content
contentExcerpt
isPostObservedByMe
postObservingUsersCount
}
`