Skip to content

Commit

Permalink
refactor(service): rename setting repostory
Browse files Browse the repository at this point in the history
  • Loading branch information
oceanlvr committed Aug 19, 2021
1 parent 6e740f5 commit 5db8fb4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 16 deletions.
9 changes: 0 additions & 9 deletions src/database/services/ConnectionService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,6 @@ export default class ConnectionService {
await this.updateWithCascade(id, data[i])
}
}
// await this.connectionRepository.save(
// data.map((entity: ConnectionEntity) => {
// return {
// ...entity,
// updateAt: time.getNowDate(),
// createAt: entity.createAt ? entity.createAt : time.getNowDate(),
// }
// }) as ConnectionEntity[],
// )
} catch (err) {
console.error(err.toString())

Expand Down
10 changes: 5 additions & 5 deletions src/database/services/SettingService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ import { Repository } from 'typeorm'
export default class SettingService {
constructor(
@InjectRepository(SettingEntity)
private collectionRepository: Repository<SettingEntity>,
private settingRepository: Repository<SettingEntity>,
) {}

public async set() {
const data = await this.collectionRepository.find()
const data = await this.settingRepository.find()
if (data.length) {
return
}
return await this.collectionRepository.insert({})
return await this.settingRepository.insert({})
}

public async get() {
const data = await this.collectionRepository.find()
const data = await this.settingRepository.find()
if (!data.length) {
return
}
Expand All @@ -31,6 +31,6 @@ export default class SettingService {
return
}
const { id } = setting
return await this.collectionRepository.update(id, payload)
return await this.settingRepository.update(id, payload)
}
}
2 changes: 1 addition & 1 deletion src/views/connections/ConnectionForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ export default class ConnectionCreate extends Vue {
msgError = this.$t('common.createfailed') as string
} else {
if (data.id) {
res = await connectionService.update(data.id, data)
res = await connectionService.updateWithCascade(data.id, data)
msgError = this.$t('common.editfailed') as string
}
}
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es6",
"target": "ES2019",
"module": "esnext",
"strict": true,
"jsx": "preserve",
Expand Down

0 comments on commit 5db8fb4

Please sign in to comment.