Skip to content

Commit

Permalink
renamed created/update attributes to be *_at
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-tavares committed May 12, 2020
1 parent 78c8194 commit cd9d9b3
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions x-pack/plugins/endpoint/common/generate_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -509,9 +509,9 @@ export class EndpointDocGenerator {
id: this.seededUUIDv4(),
name: 'Endpoint Policy',
description: 'Policy to protect the worlds data',
created_on: created,
created_at: created,
created_by: 'elastic',
updated_on: new Date().toISOString(),
updated_at: new Date().toISOString(),
updated_by: 'elastic',
config_id: this.seededUUIDv4(),
enabled: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ describe('policy details: ', () => {
id: '',
name: '',
description: '',
created_on: '',
created_at: '',
created_by: '',
updated_on: '',
updated_at: '',
updated_by: '',
config_id: '',
enabled: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const policyDetailsForUpdate: (
state: Immutable<PolicyDetailsState>
) => Immutable<NewPolicyData> | undefined = createSelector(policyDetails, policy => {
if (policy) {
const { id, revision, created_by, created_on, updated_by, updated_on, ...newPolicy } = policy;
const { id, revision, created_by, created_at, updated_by, updated_at, ...newPolicy } = policy;
return newPolicy;
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ describe('Ingest Manager - storedDatasourceToAgentDatasource', () => {
id: 'some-uuid',
name: 'mock-datasource',
description: '',
created_on: '',
created_at: '',
created_by: '',
updated_on: '',
updated_at: '',
updated_by: '',
config_id: '',
enabled: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ export interface Datasource extends Omit<NewDatasource, 'inputs'> {
id: string;
inputs: DatasourceInput[];
revision: number;
updated_on: string;
updated_at: string;
updated_by: string;
created_on: string;
created_at: string;
created_by: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ export const EditDatasourcePage: React.FunctionComponent = () => {
revision,
inputs,
created_by,
created_on,
created_at,
updated_by,
updated_on,
updated_at,
...restOfDatasource
} = datasourceData.item;
// Remove `agent_stream` from all stream info, we assign this after saving
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/ingest_manager/server/saved_objects/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,9 @@ const savedObjectTypes: { [key: string]: SavedObjectsType } = {
},
},
revision: { type: 'integer' },
updated_on: { type: 'date' },
updated_at: { type: 'date' },
updated_by: { type: 'keyword' },
created_on: { type: 'date' },
created_at: { type: 'date' },
created_by: { type: 'keyword' },
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Datasource } from '../../types/models';

type Pre790Datasource = Exclude<
Datasource,
'created_on' | 'created_by' | 'updated_on' | 'updated_by'
'created_at' | 'created_by' | 'updated_at' | 'updated_by'
>;

export const migrateDatasourcesToV790: SavedObjectMigrationFn<
Expand All @@ -21,9 +21,9 @@ export const migrateDatasourcesToV790: SavedObjectMigrationFn<
const defDate = new Date().toISOString();

updatedDatasource.attributes.created_by = 'system';
updatedDatasource.attributes.created_on = updatedDatasource?.updated_at ?? defDate;
updatedDatasource.attributes.created_at = updatedDatasource?.updated_at ?? defDate;
updatedDatasource.attributes.updated_by = 'system';
updatedDatasource.attributes.updated_on = updatedDatasource?.updated_at ?? defDate;
updatedDatasource.attributes.updated_at = updatedDatasource?.updated_at ?? defDate;

return updatedDatasource;
};
6 changes: 3 additions & 3 deletions x-pack/plugins/ingest_manager/server/services/datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ class DatasourceService {
{
...datasource,
revision: 1,
created_on: isoDate,
created_at: isoDate,
created_by: options?.user?.username ?? 'system',
updated_on: isoDate,
updated_at: isoDate,
updated_by: options?.user?.username ?? 'system',
},
options
Expand Down Expand Up @@ -139,7 +139,7 @@ class DatasourceService {
await soClient.update<Datasource>(SAVED_OBJECT_TYPE, id, {
...datasource,
revision: oldDatasource.revision + 1,
updated_on: new Date().toISOString(),
updated_at: new Date().toISOString(),
updated_by: options?.user?.username ?? 'system',
});

Expand Down

0 comments on commit cd9d9b3

Please sign in to comment.