feat(workspaces): work(space) invader default logos (#2708)

* feat(workspaces): add default logo index

* Added WorkspaceAvatar component

* Added WorkspaceAvatar component

* Fix issues

* Fix Avatar

---------

Co-authored-by: Mike Tasset <mike.tasset@gmail.com>
This commit is contained in:
Chuck Driesler
2024-08-21 13:53:37 +01:00
committed by GitHub
parent b1f4ba1674
commit 63735eb044
27 changed files with 198 additions and 29 deletions
@@ -220,7 +220,7 @@ export = FF_WORKSPACES_MODULE_ENABLED
},
WorkspaceMutations: {
create: async (_parent, args, context) => {
const { name, description } = args.input
const { name, description, defaultLogoIndex } = args.input
const createWorkspace = createWorkspaceFactory({
upsertWorkspace: upsertWorkspaceFactory({ db }),
@@ -233,7 +233,8 @@ export = FF_WORKSPACES_MODULE_ENABLED
workspaceInput: {
name,
description: description || null,
logo: null
logo: null,
defaultLogoIndex: defaultLogoIndex || 0
},
userResourceAccessLimits: context.resourceAccessRules
})
@@ -6,7 +6,8 @@ export const Workspaces = buildTableHelper('workspaces', [
'description',
'createdAt',
'updatedAt',
'logo'
'logo',
'defaultLogoIndex'
])
export const WorkspaceAcl = buildTableHelper('workspace_acl', [
@@ -92,7 +92,7 @@ export const upsertWorkspaceFactory =
.workspaces(db)
.insert(workspace)
.onConflict('id')
.merge(['description', 'logo', 'name', 'updatedAt'])
.merge(['description', 'logo', 'defaultLogoIndex', 'name', 'updatedAt'])
}
export const deleteWorkspaceFactory =
@@ -51,6 +51,7 @@ type WorkspaceCreateArgs = {
name: string
description: string | null
logo: string | null
defaultLogoIndex: number
}
userResourceAccessLimits: MaybeNullOrUndefined<TokenResourceIdentifier[]>
}
@@ -108,6 +109,7 @@ type WorkspaceUpdateArgs = {
name?: string | null
description?: string | null
logo?: string | null
defaultLogoIndex?: number | null
}
}
@@ -61,7 +61,8 @@ export const createTestWorkspace = async (
workspaceInput: {
name: workspace.name,
description: workspace.description || null,
logo: workspace.logo || null
logo: workspace.logo || null,
defaultLogoIndex: 0
},
userResourceAccessLimits: null
})
@@ -51,7 +51,8 @@ const createAndStoreTestWorkspace = async (): Promise<Workspace> => {
createdAt: new Date(),
updatedAt: new Date(),
description: null,
logo: null
logo: null,
defaultLogoIndex: 0
}
await upsertWorkspace({ workspace })
@@ -61,7 +61,8 @@ const getCreateWorkspaceInput = () => {
workspaceInput: {
description: 'foobar',
logo: null,
name: cryptoRandomString({ length: 6 })
name: cryptoRandomString({ length: 6 }),
defaultLogoIndex: 0
}
}
}