Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Store iconUrl in workspace.data #102

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/Controllers/Http/WorkspaceController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export default class WorkspaceController {
.update({
name: data.name,
services: JSON.stringify(data.services),
iconUrl: data.iconUrl,
});

// Get updated row
Expand Down Expand Up @@ -171,6 +172,7 @@ export default class WorkspaceController {
workspacesArray = workspaces.map((workspace: any) => ({
id: workspace.workspaceId,
name: workspace.name,
iconUrl: workspace.iconUrl,
order: workspace.order,
services:
typeof workspace.services === 'string'
Expand Down
3 changes: 3 additions & 0 deletions app/Models/Workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ export default class Workspace extends BaseModel {
@column()
public data: string;

@column()
public iconUrl: string;

@column.dateTime({ autoCreate: true })
public createdAt: DateTime;

Expand Down
17 changes: 17 additions & 0 deletions database/migrations/1707993515903_add_workspace_icon_urls.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import BaseSchema from '@ioc:Adonis/Lucid/Schema'

export default class extends BaseSchema {
protected tableName = 'workspaces'

public async up () {
this.schema.alterTable(this.tableName, (table) => {
table.string('icon_url').nullable()
})
}

public async down () {
this.schema.alterTable(this.tableName, (table) => {
table.dropColumn('icon_url')
})
}
}
Loading