Skip to content

Commit

Permalink
fix: use snake case property names in createQueryBuilder instance met…
Browse files Browse the repository at this point in the history
…hods
  • Loading branch information
zeeshanakram3 committed Feb 17, 2024
1 parent 7fa630a commit 4e5cf77
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion docs/operator-guide/tutorials/upgrading-orion.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Always make sure the versions of Orion and Atlas you're planing to upgrade to ar

1. **Backup the databse** before the upgrade. You can do that by executing the following command on the production server:
```bash
docker exec orion_db pg_dumpall -U postgres > "orion-production-$(date '+%Y-%m-%d').bak"
docker exec orion_db pg_dumpall -U postgres -p 23798 > "orion-production-$(date '+%Y-%m-%d').bak"
```
Make sure the backup file was successfully created in the current directory.
1. Stop the processor and create [Offchain data export](../../developer-guide/tutorials/preserving-offchain-state.md) file:
Expand Down
35 changes: 18 additions & 17 deletions src/server-extension/resolvers/AdminResolver/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,27 @@ import { GraphQLResolveInfo } from 'graphql'
import 'reflect-metadata'
import { Args, Ctx, Info, Int, Mutation, Query, Resolver, UseMiddleware } from 'type-graphql'
import { EntityManager, In, Not, UpdateResult } from 'typeorm'
import { parseVideoTitle } from '../../../mappings/content/utils'
import { videoRelevanceManager } from '../../../mappings/utils'
import {
Account,
Channel,
ChannelRecipient,
NftFeaturedOnMarketPlace,
OperatorPermission,
OwnedNft,
User,
Video,
VideoCategory,
Account,
ChannelRecipient,
NftFeaturedOnMarketPlace,
VideoFeaturedInCategory,
VideoHero as VideoHeroEntity,
} from '../../../model'
import { ConfigVariable, config } from '../../../utils/config'
import { addNotification } from '../../../utils/notification'
import { withHiddenEntities } from '../../../utils/sql'
import { VideoHero } from '../baseTypes'
import { OperatorOnly } from '../middleware'
import { model } from '../model'
import {
AppActionSignatureInput,
AppRootDomain,
Expand Down Expand Up @@ -66,10 +70,7 @@ import {
VideoViewPerUserTimeLimit,
VideoWeights,
} from './types'
import { parseVideoTitle } from '../../../mappings/content/utils'
import { addNotification } from '../../../utils/notification'
import { processCommentsCensorshipStatusUpdate } from './utils'
import { model } from '../model'

@Resolver()
export class AdminResolver {
Expand Down Expand Up @@ -209,7 +210,7 @@ export class AdminResolver {
async (transactionalEntityManager) => {
return transactionalEntityManager
.createQueryBuilder()
.update(Channel)
.update<Channel>(Channel)
.set({ channelWeight: weight })
.where('id = :id', { id: channelId })
.execute()
Expand Down Expand Up @@ -364,14 +365,14 @@ export class AdminResolver {
if (supportedCategoriesIds) {
await em
.createQueryBuilder()
.update(`admin.video_category`)
.set({ is_supported: false })
.update<VideoCategory>(VideoCategory)
.set({ isSupported: false })
.execute()
if (supportedCategoriesIds.length) {
const result = await em
.createQueryBuilder()
.update(`admin.video_category`)
.set({ is_supported: true })
.update<VideoCategory>(VideoCategory)
.set({ isSupported: true })
.where({ id: In(supportedCategoriesIds) })
.execute()
newNumberOfCategoriesSupported = result.affected || 0
Expand Down Expand Up @@ -483,23 +484,23 @@ export const setFeaturedNftsInner = async (em: EntityManager, featuredNftsIds: s

await em
.createQueryBuilder()
.update(`admin.owned_nft`)
.set({ is_featured: false })
.where({ is_featured: true })
.update<OwnedNft>(OwnedNft)
.set({ isFeatured: false })
.where({ isFeatured: true })
.execute()

if (featuredNftsIds.length) {
const result = await em
.createQueryBuilder()
.update(`admin.owned_nft`)
.set({ is_featured: true })
.update<OwnedNft>(OwnedNft)
.set({ isFeatured: true })
.where({ id: In(featuredNftsIds) })
.execute()
newNumberOfNftsFeatured = result.affected || 0

// fetch all featured nfts and deposit notification for their creators
for (const featuredNftId of featuredNftsIds) {
const featuredNft = await em.getRepository('OwnedNft').findOne({
const featuredNft = await em.getRepository<OwnedNft>(OwnedNft).findOne({
where: { id: featuredNftId },
relations: { video: { channel: true } },
})
Expand Down

0 comments on commit 4e5cf77

Please sign in to comment.