-
Notifications
You must be signed in to change notification settings - Fork 53
feat:split bundle and update schema #30
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| /** | ||
| * Copyright (c) 2023 - present TinyEngine Authors. | ||
| * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. | ||
| * | ||
| * Use of this source code is governed by an MIT-style license. | ||
| * | ||
| * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, | ||
| * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR | ||
| * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. | ||
| * | ||
| */ | ||
| import { Controller } from 'egg'; | ||
| import { I_CreateComponentLibrary } from '../../lib/interface'; | ||
|
|
||
| export default class ComponentController extends Controller { | ||
|
|
||
| /** | ||
| * @summary 注册组件库 | ||
| * @router POST /api/componentLibrary/create | ||
| */ | ||
| async create(){ | ||
| const data: I_CreateComponentLibrary = this.ctx.request.body; | ||
| this.ctx.body = await this.service.materialCenter.componentLibrary.create(data); | ||
| } | ||
|
|
||
| /** | ||
| * @summary 查询组件库 | ||
| * @router GET | ||
| */ | ||
| async find(){ | ||
| this.ctx.body = await this.service.materialCenter.componentLibrary.find(this.ctx.query); | ||
| } | ||
zhangjuncao marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| /** | ||
| * @summary 更新组件库 | ||
| * @router PUT | ||
| */ | ||
| async update(){ | ||
| const { id } = this.ctx.params; | ||
| const params = this.ctx.request.body; | ||
| this.ctx.body = await this.service.materialCenter.componentLibrary.update({id, ...params }); | ||
| } | ||
zhangjuncao marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| /** | ||
| * @summary 删除组件库 | ||
| * @router DELETE | ||
| */ | ||
| async delete(){ | ||
| const { id } = this.ctx.params; | ||
| this.ctx.body = await this.service.materialCenter.componentLibrary.delete({ id }); | ||
| } | ||
zhangjuncao marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| /** | ||
| * Copyright (c) 2023 - present TinyEngine Authors. | ||
| * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. | ||
| * | ||
| * Use of this source code is governed by an MIT-style license. | ||
| * | ||
| * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, | ||
| * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR | ||
| * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. | ||
| * | ||
| */ | ||
| import { Controller } from 'egg'; | ||
|
|
||
| export default class UserComponentController extends Controller { | ||
|
|
||
| /** | ||
| * @summary 创建组件库 | ||
| * @router POST /component/bundle/create | ||
| */ | ||
| async bundleCreate(){ | ||
| const ctx = this.ctx; | ||
| try { | ||
| const fileStream = await ctx.getFileStream(); | ||
| this.ctx.body = await this.ctx.service.materialCenter.userComponents.bundleCreate(fileStream); | ||
| } catch (error) { | ||
| ctx.logger.error('[UserComponentController] bundleCreate error:', error); | ||
| }; | ||
| } | ||
zhangjuncao marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| /** | ||
| * Copyright (c) 2023 - present TinyEngine Authors. | ||
| * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. | ||
| * | ||
| * Use of this source code is governed by an MIT-style license. | ||
| * | ||
| * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, | ||
| * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR | ||
| * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. | ||
| * | ||
| */ | ||
| import { E_Method } from '../../lib/enum'; | ||
| import { I_CreateComponentLibrary } from '../../lib/interface'; | ||
| import * as qs from 'querystring'; | ||
| import DataService from '../dataService'; | ||
|
|
||
| export default class ComponentLibrary extends DataService{ | ||
|
|
||
| async create(param: I_CreateComponentLibrary) { | ||
| return this.query({ | ||
| url: 'component-library' , | ||
| method: E_Method.Post, | ||
| data: param | ||
| }); | ||
| } | ||
|
|
||
| async find(param){ | ||
| const query = qs.stringify(param); | ||
| return this.query({ | ||
| url: `component-library?${query}` | ||
| }); | ||
| } | ||
|
|
||
| async list() { | ||
| return this.query({ url: 'component-library' }); | ||
| } | ||
|
|
||
| async update(param) { | ||
| const { id } = param; | ||
| return this.query({ | ||
| url: `component-library/${id}`, | ||
| method: E_Method.Put, | ||
| data: param | ||
| }); | ||
| } | ||
|
|
||
| delete({ id }){ | ||
| return this.query({ | ||
| url: `component-library/${id}`, | ||
| method: E_Method.Delete | ||
| }); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| /** | ||
| * Copyright (c) 2023 - present TinyEngine Authors. | ||
| * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. | ||
| * | ||
| * Use of this source code is governed by an MIT-style license. | ||
| * | ||
| * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, | ||
| * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR | ||
| * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. | ||
| * | ||
| */ | ||
| import { E_Method } from '../../lib/enum'; | ||
| import DataService from '../dataService'; | ||
| import * as qs from 'querystring'; | ||
|
|
||
| export default class Material extends DataService{ | ||
|
|
||
| private base = 'materials'; | ||
|
|
||
| async update(param) { | ||
| const {id} = param; | ||
| return this.query({ | ||
| url: `materials/${id}`, | ||
| method: E_Method.Put, | ||
| data: param | ||
| }); | ||
|
|
||
| } | ||
|
|
||
| async find(param) { | ||
| const query = typeof param === 'string' ? param : qs.stringify(param); | ||
| return this.fQuery({ | ||
| url: `${this.base}?${query}` | ||
| }); | ||
| } | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| /** | ||
| * Copyright (c) 2023 - present TinyEngine Authors. | ||
| * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. | ||
| * | ||
| * Use of this source code is governed by an MIT-style license. | ||
| * | ||
| * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, | ||
| * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR | ||
| * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. | ||
| * | ||
| */ | ||
| import { E_Method } from '../../lib/enum'; | ||
| import DataService from '../dataService'; | ||
| import * as qs from 'querystring'; | ||
|
|
||
| export default class MaterialHistories extends DataService{ | ||
|
|
||
| private base = 'material-histories'; | ||
|
|
||
| async create(param) { | ||
| return this.fQuery({ | ||
| url: 'material-histories', | ||
| method: E_Method.Post, | ||
| data: param | ||
| }); | ||
| } | ||
|
|
||
| async update(param) { | ||
| const {id} = param; | ||
| return this.query({ | ||
| url: `material-histories/${id}`, | ||
| method: E_Method.Put, | ||
| data: param | ||
| }); | ||
|
|
||
| } | ||
|
|
||
| async find(param) { | ||
| const query = typeof param === 'string' ? param : qs.stringify(param); | ||
| return this.fQuery({ | ||
| url: `${this.base}?${query}` | ||
| }); | ||
| } | ||
|
|
||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.