mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
Merge branch 'feature/agenda-new-api-peter' into feature/agenda-new-api-eudes
This commit is contained in:
@@ -21,7 +21,21 @@ export class AgendaDataRepositoryService {
|
||||
private agendaDataService: AgendaDataService,
|
||||
private utils: Utils,
|
||||
private agendaLocalDataSourceService: AgendaLocalDataSourceService
|
||||
) { }
|
||||
) {}
|
||||
|
||||
createOwnCalendar() {
|
||||
const currentUserCalendar = {
|
||||
wxUserId: SessionStore.user.UserId,
|
||||
wxFullName: SessionStore.user.FullName,
|
||||
wxeMail: SessionStore.user.Email,
|
||||
role: SessionStore.user.RoleDescription,
|
||||
roleId: SessionStore.user.RoleID,
|
||||
shareType: 0,
|
||||
date: '',
|
||||
}
|
||||
|
||||
return this.agendaLocalDataSourceService.createCalendar(currentUserCalendar)
|
||||
}
|
||||
|
||||
async getEventById(id: string) {
|
||||
try {
|
||||
@@ -176,23 +190,14 @@ export class AgendaDataRepositoryService {
|
||||
const result = await this.agendaDataService.getSharedCalendar()
|
||||
|
||||
if(result.isOk()) {
|
||||
await this.agendaLocalDataSourceService.clearSharedCalendar()
|
||||
|
||||
if(result.value?.data) {
|
||||
|
||||
const currentUserCalendar = {
|
||||
wxUserId: SessionStore.user.UserId,
|
||||
wxFullName: SessionStore.user.FullName,
|
||||
wxeMail: SessionStore.user.Email,
|
||||
role: SessionStore.user.RoleDescription,
|
||||
roleId: SessionStore.user.RoleID,
|
||||
shareType: 0,
|
||||
date: '',
|
||||
}
|
||||
|
||||
result.value.data.push(currentUserCalendar)
|
||||
|
||||
await this.agendaLocalDataSourceService.clearSharedCalendar()
|
||||
await this.createOwnCalendar()
|
||||
return await this.agendaLocalDataSourceService.bulkCreate(result.value.data)
|
||||
} else {
|
||||
await this.createOwnCalendar()
|
||||
return result
|
||||
}
|
||||
} else {
|
||||
@@ -201,6 +206,10 @@ export class AgendaDataRepositoryService {
|
||||
|
||||
}
|
||||
|
||||
async clearSharedCalendar() {
|
||||
return await this.agendaLocalDataSourceService.clearSharedCalendar()
|
||||
}
|
||||
|
||||
getShareCalendarItemsLive() {
|
||||
return this.agendaLocalDataSourceService.getShareCalendarItemsLive()
|
||||
}
|
||||
|
||||
@@ -45,6 +45,16 @@ export class AgendaLocalDataSourceService {
|
||||
}
|
||||
}
|
||||
|
||||
async createCalendar(data: SharedCalendarListItemOutputDTO) {
|
||||
// db.eve
|
||||
try {
|
||||
const result = await AgendaDataSource.shareCalendar.add(data)
|
||||
return ok(result)
|
||||
} catch (e) {
|
||||
return err(false)
|
||||
}
|
||||
}
|
||||
|
||||
clearSharedCalendar() {
|
||||
// db.eve
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user