Skip to content
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

Techdebt: refactor draft endpoints #995

Merged
merged 52 commits into from
Jul 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
b45f0b0
improved code for draft
anissa-agahchen Mar 29, 2023
adb2eab
Merge branch 'dev' of https://github.com/bcgov/biohubbc into BHBC-2282
anissa-agahchen Mar 29, 2023
507c23f
tweak
anissa-agahchen Mar 29, 2023
8f21aa3
declared formData at the top of the component
anissa-agahchen Mar 29, 2023
2d01f22
fix tests
anissa-agahchen Mar 30, 2023
a7de08a
add test to get a single draft
anissa-agahchen Mar 30, 2023
8dc4f6f
remove commented code
anissa-agahchen Mar 30, 2023
7060339
one more
anissa-agahchen Mar 30, 2023
ff02c26
trying out without usestate and add a null check on formik.current
anissa-agahchen Apr 3, 2023
27d9e7d
Merge branch 'dev' of https://github.com/bcgov/biohubbc into BHBC-2282
anissa-agahchen Apr 4, 2023
51efa66
some refactoring of the draft functionality
anissa-agahchen Apr 5, 2023
e75ab01
Merge branch 'dev' of https://github.com/bcgov/biohubbc into BHBC-2282
anissa-agahchen Apr 5, 2023
ade76e3
draft project UI complete
anissa-agahchen Apr 5, 2023
05ca4e6
created draft service and repo and using zod
anissa-agahchen Apr 6, 2023
4edd6a2
related changes
anissa-agahchen Apr 6, 2023
1ec6686
remove log
anissa-agahchen Apr 6, 2023
6835184
create endpoint refactored
anissa-agahchen Apr 7, 2023
c25ab90
Merge branch 'dev' of https://github.com/bcgov/biohubbc into BHBC-2282
anissa-agahchen Apr 7, 2023
348bef0
refactoring draft endpoints
anissa-agahchen Apr 11, 2023
e00ffcb
rename model
anissa-agahchen Apr 11, 2023
0622137
fixed merge conflicts
anissa-agahchen Apr 24, 2023
67ccf24
working through
anissa-agahchen Apr 24, 2023
23dd6cc
added a zod util for the json structure
anissa-agahchen Apr 24, 2023
2d66edb
merge conflicts resolved
anissa-agahchen Apr 24, 2023
b74d2ce
adding jsdoc
anissa-agahchen Apr 24, 2023
d0bf9c3
create endpoint tested
anissa-agahchen Apr 25, 2023
8e8ffdb
tweak
anissa-agahchen Apr 25, 2023
c0e06e7
get draft endpoint tested
anissa-agahchen Apr 25, 2023
43d7d5b
Merge branch 'dev' of https://github.com/bcgov/biohubbc into draft-te…
anissa-agahchen Apr 25, 2023
99f6f0b
tests written for drat/list endpoint
anissa-agahchen Apr 25, 2023
54fb7a7
delete draft endpoint
anissa-agahchen Apr 25, 2023
aca5248
draft service tests in progress
anissa-agahchen Apr 26, 2023
c6fb9d5
Merge branch 'dev' of https://github.com/bcgov/biohubbc into draft-te…
anissa-agahchen Apr 26, 2023
edf3fa9
merge conflicts
anissa-agahchen Jun 28, 2023
282a13b
skip and remove old/broken tests
anissa-agahchen Jun 28, 2023
947a7f8
clean up
anissa-agahchen Jun 28, 2023
49e62f7
fixed draft api tests
al-rosenthal Jun 28, 2023
782d26e
fixing create project tests
al-rosenthal Jun 29, 2023
6ddedd0
removed skips
al-rosenthal Jun 29, 2023
7dac6fe
added repo
al-rosenthal Jun 29, 2023
c658db9
removed only
al-rosenthal Jun 29, 2023
ade67f4
added draft repo tests
al-rosenthal Jun 29, 2023
21fbca3
removed only
al-rosenthal Jun 29, 2023
ed9d481
fixed test, added jsdocs
al-rosenthal Jun 30, 2023
ec9376d
ran fix
al-rosenthal Jun 30, 2023
d533a28
updating more things
al-rosenthal Jun 30, 2023
6a1438a
fixed broken test
al-rosenthal Jun 30, 2023
f07c7cd
ran checkout on smoketest to bring back to dev
al-rosenthal Jun 30, 2023
cb12ff5
fixing code smells
al-rosenthal Jun 30, 2023
f0c86d2
fixed test ignore-skip
al-rosenthal Jun 30, 2023
4001d06
Merge branch 'dev' into draft-techdebt
al-rosenthal Jun 30, 2023
bab9a07
code cov increase
KjartanE Jul 4, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions api/src/models/draft-create.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { getLogger } from '../utils/logger';

const defaultLog = getLogger('models/draft-create');

export class PostPutDraftObject {
anissa-agahchen marked this conversation as resolved.
Show resolved Hide resolved
name: string;
data: object;

constructor(obj?: any) {
defaultLog.debug({ label: 'PostPutDraftData', message: 'params', obj });

this.name = obj?.name || null;
this.data = (obj?.data && obj.data) || {};
}
}
12 changes: 12 additions & 0 deletions api/src/models/project-create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,15 @@ export class PostPartnershipsData {
this.stakeholder_partnerships = (obj?.stakeholder_partnerships.length && obj.stakeholder_partnerships) || [];
}
}

export class PostDraftData {
name: string;
data: object;

constructor(obj?: any) {
defaultLog.debug({ label: 'PostDraftData', message: 'params', obj });

this.name = obj?.name || null;
this.data = (obj?.data && obj.data) || {};
}
}
17 changes: 12 additions & 5 deletions api/src/openapi/schemas/draft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,25 @@
export const draftResponseObject = {
title: 'Draft Response Object',
type: 'object',
required: ['id', 'name', 'date'],
required: ['webform_draft_id', 'name', 'create_date', 'update_date'],
properties: {
id: {
webform_draft_id: {
type: 'number'
},
name: {
type: 'string',
description: 'The name of the draft'
},
date: {
description: 'The date this draft was last updated or created',
oneOf: [{ type: 'string', format: 'date' }, { type: 'object' }]
create_date: {
oneOf: [{ type: 'object' }, { type: 'string', format: 'date' }],
description: 'ISO 8601 date string for the date the draft was created'
},
update_date: {
oneOf: [
{ type: 'object', nullable: true },
{ type: 'string', format: 'date' }
],
description: 'ISO 8601 date string for the date the draft was updated'
}
}
};
Expand Down
Loading