@ubkinfotech/tecaher-erp 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -29,14 +29,22 @@ export async function fetchNoteDetails(api, args) {
29
29
  const res = await api.get(endpoints.notes.details(args));
30
30
  return res.data;
31
31
  }
32
- export async function uploadNoteFile(api, file) {
32
+ function buildUploadFilePath(relativePath, schoolCode) {
33
+ const normalized = String(relativePath).replace(/\\/g, '/').replace(/^\/+/, '');
34
+ if (!schoolCode) {
35
+ return normalized;
36
+ }
37
+ const withoutUploads = normalized.replace(/^uploads\//i, '');
38
+ return `school_${schoolCode}/${withoutUploads}`;
39
+ }
40
+ export async function uploadNoteFile(api, file, schoolCode) {
33
41
  const formData = new FormData();
34
42
  formData.append('file', {
35
43
  uri: file.uri,
36
44
  name: file.name,
37
45
  type: file.type
38
46
  });
39
- formData.append('filepath', 'uploads/student/note/');
47
+ formData.append('filepath', buildUploadFilePath('student/note/', schoolCode));
40
48
  const res = await api.post(endpoints.notes.upload, formData, {
41
49
  headers: {
42
50
  'Content-Type': 'multipart/form-data'
@@ -50,7 +50,7 @@ export type UploadFileInput = {
50
50
  name: string;
51
51
  type: string;
52
52
  };
53
- export declare function uploadAssignmentFile(api: AxiosInstance, file: UploadFileInput): Promise<ApiResult<string>>;
53
+ export declare function uploadAssignmentFile(api: AxiosInstance, file: UploadFileInput, _schoolCode?: string): Promise<ApiResult<string>>;
54
54
  export type HomeworkSubmissionItem = {
55
55
  id?: string | number;
56
56
  student_name?: string;
@@ -34,6 +34,6 @@ export type ApplyLeavePayload = {
34
34
  };
35
35
  export declare function fetchLeaveRequests(api: AxiosInstance, params: LeaveRequestListParams): Promise<ApiResult<unknown>>;
36
36
  export declare function fetchLeaveTypes(api: AxiosInstance): Promise<ApiResult<LeaveTypeItem[]>>;
37
- export declare function uploadLeaveFile(api: AxiosInstance, file: UploadFileInput): Promise<ApiResult<string>>;
37
+ export declare function uploadLeaveFile(api: AxiosInstance, file: UploadFileInput, schoolCode?: string): Promise<ApiResult<string>>;
38
38
  export declare function applyLeave(api: AxiosInstance, payload: ApplyLeavePayload): Promise<ApiResult<unknown>>;
39
39
  //# sourceMappingURL=leaveRequestService.d.ts.map
@@ -41,7 +41,7 @@ export type UploadFileInput = {
41
41
  name: string;
42
42
  type: string;
43
43
  };
44
- export declare function uploadNoteFile(api: AxiosInstance, file: UploadFileInput): Promise<ApiResult<string>>;
44
+ export declare function uploadNoteFile(api: AxiosInstance, file: UploadFileInput, schoolCode?: string): Promise<ApiResult<string>>;
45
45
  export type SaveNotePayload = {
46
46
  id?: string | number;
47
47
  title: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ubkinfotech/tecaher-erp",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },