fix job adapter response handling, update tier names
This commit is contained in:
parent
18b60f2c9b
commit
0cf7982809
2 changed files with 40 additions and 4 deletions
|
|
@ -25,6 +25,24 @@ export interface SearchJobSkillsParams {
|
||||||
filters?: { group?: number }
|
filters?: { group?: number }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Payload for updating a job entity
|
||||||
|
*/
|
||||||
|
export interface JobUpdatePayload {
|
||||||
|
name_en?: string
|
||||||
|
name_jp?: string
|
||||||
|
granblue_id?: string
|
||||||
|
proficiency1?: number
|
||||||
|
proficiency2?: number
|
||||||
|
row?: string
|
||||||
|
order?: number
|
||||||
|
master_level?: boolean
|
||||||
|
ultimate_mastery?: boolean
|
||||||
|
accessory?: boolean
|
||||||
|
accessory_type?: number
|
||||||
|
base_job_id?: string | null
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Job skill search response
|
* Job skill search response
|
||||||
*/
|
*/
|
||||||
|
|
@ -65,11 +83,11 @@ export class JobAdapter extends BaseAdapter {
|
||||||
* Gets a single job by ID
|
* Gets a single job by ID
|
||||||
*/
|
*/
|
||||||
async getById(id: string): Promise<Job> {
|
async getById(id: string): Promise<Job> {
|
||||||
const response = await this.request<{ job: Job }>(`/jobs/${id}`, {
|
const response = await this.request<Job>(`/jobs/${id}`, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
cacheTTL: 300000 // Cache for 5 minutes
|
cacheTTL: 300000 // Cache for 5 minutes
|
||||||
})
|
})
|
||||||
return response.job
|
return response
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -99,6 +117,22 @@ export class JobAdapter extends BaseAdapter {
|
||||||
return response.accessories
|
return response.accessories
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates a job entity (database admin function)
|
||||||
|
* @param granblueId The job's granblue_id
|
||||||
|
* @param data The fields to update
|
||||||
|
*/
|
||||||
|
async updateJob(granblueId: string, data: JobUpdatePayload): Promise<Job> {
|
||||||
|
const response = await this.request<Job>(`/jobs/${granblueId}`, {
|
||||||
|
method: 'PUT',
|
||||||
|
body: data
|
||||||
|
})
|
||||||
|
// Clear jobs cache to reflect the change
|
||||||
|
this.clearCache('/jobs')
|
||||||
|
this.clearCache(`/jobs/${granblueId}`)
|
||||||
|
return response
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches for job skills based on query and filters
|
* Searches for job skills based on query and filters
|
||||||
* Used for the skill selection interface with pagination
|
* Used for the skill selection interface with pagination
|
||||||
|
|
|
||||||
|
|
@ -93,8 +93,9 @@ export function getJobTierName(row: string | number): string {
|
||||||
'3': 'Class III',
|
'3': 'Class III',
|
||||||
'4': 'Class IV',
|
'4': 'Class IV',
|
||||||
'5': 'Class V',
|
'5': 'Class V',
|
||||||
ex: 'Extra',
|
ex: 'EX',
|
||||||
ex2: 'Extra II'
|
ex1: 'EX',
|
||||||
|
ex2: 'EXII'
|
||||||
}
|
}
|
||||||
|
|
||||||
const rowStr = row.toString().toLowerCase()
|
const rowStr = row.toString().toLowerCase()
|
||||||
|
|
@ -113,6 +114,7 @@ export function getJobTierOrder(row: string | number): number {
|
||||||
'4': 4,
|
'4': 4,
|
||||||
'5': 5,
|
'5': 5,
|
||||||
ex: 6,
|
ex: 6,
|
||||||
|
ex1: 6,
|
||||||
ex2: 7
|
ex2: 7
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue