mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Fixed Badges Seeder and URL Fix Middleware
This commit is contained in:
parent
c50b881089
commit
5597e34dab
@ -1,9 +1,14 @@
|
|||||||
|
|
||||||
|
const urlSearchAlpha = 'https://api-alpha.human-connection.org'
|
||||||
|
const urlSearchLocal = 'http://localhost:3000'
|
||||||
|
|
||||||
export const fixUrl = (url) => {
|
export const fixUrl = (url) => {
|
||||||
return url.replace('https://api-alpha.human-connection.org', 'http://localhost:3000')
|
url = url.replace(urlSearchAlpha, '')
|
||||||
|
url = url.replace(urlSearchLocal, '')
|
||||||
|
return url
|
||||||
}
|
}
|
||||||
const fixImageURLs = (result, recursive) => {
|
const fixImageURLs = (result, recursive) => {
|
||||||
if (result && typeof result === 'string' && result.indexOf('https://api-alpha.human-connection.org') === 0) {
|
if (result && typeof result === 'string' && (result.indexOf(urlSearchAlpha) === 0 || result.indexOf(urlSearchLocal) === 0)) {
|
||||||
result = fixUrl(result)
|
result = fixUrl(result)
|
||||||
} else if (result && Array.isArray(result)) {
|
} else if (result && Array.isArray(result)) {
|
||||||
result.forEach((res, index) => {
|
result.forEach((res, index) => {
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
export default function (data) {
|
export default function (data) {
|
||||||
return `
|
return `
|
||||||
mutation {
|
mutation {
|
||||||
b1: CreateBadge(id: "b1", key: "indiegogo_en_racoon", type: crowdfunding, status: permanent, icon: "http://localhost:3000/img/badges/indiegogo_en_racoon.svg") { id }
|
b1: CreateBadge(id: "b1", key: "indiegogo_en_racoon", type: crowdfunding, status: permanent, icon: "/img/badges/indiegogo_en_racoon.svg") { id }
|
||||||
b2: CreateBadge(id: "b2", key: "indiegogo_en_rabbit", type: crowdfunding, status: permanent, icon: "http://localhost:3000/img/badges/indiegogo_en_rabbit.svg") { id }
|
b2: CreateBadge(id: "b2", key: "indiegogo_en_rabbit", type: crowdfunding, status: permanent, icon: "/img/badges/indiegogo_en_rabbit.svg") { id }
|
||||||
b3: CreateBadge(id: "b3", key: "indiegogo_en_wolf", type: crowdfunding, status: permanent, icon: "http://localhost:3000/img/badges/indiegogo_en_wolf.svg") { id }
|
b3: CreateBadge(id: "b3", key: "indiegogo_en_wolf", type: crowdfunding, status: permanent, icon: "/img/badges/indiegogo_en_wolf.svg") { id }
|
||||||
b4: CreateBadge(id: "b4", key: "indiegogo_en_bear", type: crowdfunding, status: permanent, icon: "http://localhost:3000/img/badges/indiegogo_en_bear.svg") { id }
|
b4: CreateBadge(id: "b4", key: "indiegogo_en_bear", type: crowdfunding, status: permanent, icon: "/img/badges/indiegogo_en_bear.svg") { id }
|
||||||
b5: CreateBadge(id: "b5", key: "indiegogo_en_turtle", type: crowdfunding, status: permanent, icon: "http://localhost:3000/img/badges/indiegogo_en_turtle.svg") { id }
|
b5: CreateBadge(id: "b5", key: "indiegogo_en_turtle", type: crowdfunding, status: permanent, icon: "/img/badges/indiegogo_en_turtle.svg") { id }
|
||||||
b6: CreateBadge(id: "b6", key: "indiegogo_en_rhino", type: crowdfunding, status: permanent, icon: "http://localhost:3000/img/badges/indiegogo_en_rhino.svg") { id }
|
b6: CreateBadge(id: "b6", key: "indiegogo_en_rhino", type: crowdfunding, status: permanent, icon: "/img/badges/indiegogo_en_rhino.svg") { id }
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,12 @@
|
|||||||
export default function (data) {
|
export default function (data) {
|
||||||
return `
|
return `
|
||||||
mutation {
|
mutation {
|
||||||
u1_blacklist_u4: AddUserBlacklisted(from: { id: "u1" }, to: { id: "u4" }) { from { id } }
|
b1_u1: AddUserBadges(from: {id: "b1"}, to: {id: "u1"}) { from { id } }
|
||||||
|
b2_u1: AddUserBadges(from: {id: "b2"}, to: {id: "u1"}) { from { id } }
|
||||||
|
b3_u1: AddUserBadges(from: {id: "b3"}, to: {id: "u1"}) { from { id } }
|
||||||
|
b6_u2: AddUserBadges(from: {id: "b6"}, to: {id: "u2"}) { from { id } }
|
||||||
|
b3_u3: AddUserBadges(from: {id: "b3"}, to: {id: "u3"}) { from { id } }
|
||||||
|
b5_u4: AddUserBadges(from: {id: "b5"}, to: {id: "u4"}) { from { id } }
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,12 +1,7 @@
|
|||||||
export default function (data) {
|
export default function (data) {
|
||||||
return `
|
return `
|
||||||
mutation {
|
mutation {
|
||||||
b1_u1: AddUserBadges(from: {id: "b1"}, to: {id: "u1"}) { from { id } }
|
u1_blacklist_u4: AddUserBlacklisted(from: { id: "u1" }, to: { id: "u4" }) { from { id } }
|
||||||
b2_u1: AddUserBadges(from: {id: "b2"}, to: {id: "u1"}) { from { id } }
|
|
||||||
b3_u1: AddUserBadges(from: {id: "b3"}, to: {id: "u1"}) { from { id } }
|
|
||||||
b6_u2: AddUserBadges(from: {id: "b6"}, to: {id: "u2"}) { from { id } }
|
|
||||||
b3_u3: AddUserBadges(from: {id: "b3"}, to: {id: "u3"}) { from { id } }
|
|
||||||
b5_u4: AddUserBadges(from: {id: "b5"}, to: {id: "u4"}) { from { id } }
|
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user